<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://weblogs.asp.net/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Eilon Lipton&amp;#39;s Blog</title><link>http://weblogs.asp.net/leftslipper/default.aspx</link><description>Technical blog on Microsoft ASP.NET and ASP.NET AJAX.</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP1 (Build: 20510.895)</generator><item><title>Upcoming talks: Microsoft Tech Ed South Africa</title><link>http://weblogs.asp.net/leftslipper/archive/2008/07/22/upcoming-talks-microsoft-tech-ed-south-africa.aspx</link><pubDate>Wed, 23 Jul 2008 05:55:02 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:6434383</guid><dc:creator>Eilon</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/leftslipper/rsscomments.aspx?PostID=6434383</wfw:commentRss><comments>http://weblogs.asp.net/leftslipper/archive/2008/07/22/upcoming-talks-microsoft-tech-ed-south-africa.aspx#comments</comments><description>&lt;p&gt;In just a couple of weeks I'll be in Durban, South Africa presenting three sessions at &lt;a href="http://www.teched.co.za/"&gt;Tech Ed&lt;/a&gt;. These are the sessions:&lt;/p&gt;  &lt;h2&gt;WEB304: Introduction to MVC Web Development&lt;/h2&gt;  &lt;p&gt;&lt;strong&gt;Day:&lt;/strong&gt; Monday, 04 August 2008, 09:15 - 10:30    &lt;br /&gt;&lt;strong&gt;Location:&lt;/strong&gt; Session Room 07    &lt;br /&gt;One of the benefits of using a MVC methodology is that it helps enforce a clean separation of concerns between the models, views, and controllers within an application. In the very near future, ASP.NET will include support for developing Web applications using an MVC-based architecture. The MVC pattern can also help enable red/green test-driven development (TDD) where you implement automated unit tests, which define and verify the requirements of new code, before you actually write the code itself. Join us for a dive into the new MVC Framework and learn how to leverage this new alternative in your own applications. &lt;/p&gt;  &lt;h2&gt;WEB306: What's new in Visual Studio 2008 for ASP.NET developers&lt;/h2&gt;  &lt;p&gt;&lt;strong&gt;Day:&lt;/strong&gt; Monday, 04 August 2008, 16:15 - 17:15    &lt;br /&gt;&lt;strong&gt;Location:&lt;/strong&gt; Session Room 08    &lt;br /&gt;Check out the latest and greatest with Microsoft Visual Studio 2008. From the CSS designer to JavaScript Intellisense, Visual Studio 2008 packs a powerful punch for building rich web applications. You&amp;#8217;ll also see how to use LINQ data access and unit testing in a web application.&lt;/p&gt;  &lt;h2&gt;WEB307: A Tour of What&amp;#8217;s New in ASP.NET 3.5&lt;/h2&gt;  &lt;p&gt;&lt;strong&gt;Day:&lt;/strong&gt; Tuesday, 05 August 2008, 16:45 - 17:45    &lt;br /&gt;&lt;strong&gt;Location:&lt;/strong&gt; Session Room 07    &lt;br /&gt;Discover how you can take advantage of the latest enhancements to ASP.NET and Visual Studio 2008 for building Web applications in your real-world applications. Enhance your web application with AJAX, Silverlight, and LINQ data access. You&amp;#8217;ll also see how to use ASP.NET Dynamic Data to build a data entry site in a matter of minutes. &lt;/p&gt;  &lt;p&gt;* Dates, times, and locations can change, so check your schedules!&lt;/p&gt;  &lt;p&gt;I hope to see some of you there, so please stop by and say hi!&lt;/p&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=6434383" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/leftslipper/archive/tags/ASP.NET/default.aspx">ASP.NET</category><category domain="http://weblogs.asp.net/leftslipper/archive/tags/Speaking/default.aspx">Speaking</category><category domain="http://weblogs.asp.net/leftslipper/archive/tags/MVC/default.aspx">MVC</category><category domain="http://weblogs.asp.net/leftslipper/archive/tags/aspnetmvc/default.aspx">aspnetmvc</category></item><item><title>HttpContext.IsCustomErrorEnabled - One of ASP.NET's hidden gems</title><link>http://weblogs.asp.net/leftslipper/archive/2008/07/13/httpcontext-iscustomerrorenabled-one-of-asp-net-s-hidden-gems.aspx</link><pubDate>Mon, 14 Jul 2008 03:30:26 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:6398779</guid><dc:creator>Eilon</dc:creator><slash:comments>6</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/leftslipper/rsscomments.aspx?PostID=6398779</wfw:commentRss><comments>http://weblogs.asp.net/leftslipper/archive/2008/07/13/httpcontext-iscustomerrorenabled-one-of-asp-net-s-hidden-gems.aspx#comments</comments><description>&lt;p&gt;Calling a property a gem might be a bit of an exaggeration, but this particular property is still rather valuable. In many situations a developer wants to enable a feature or part of a feature only for debugging and testing purposes. The &lt;a href="http://msdn.microsoft.com/en-us/library/system.web.httpcontext.iscustomerrorenabled.aspx"&gt;IsCustomErrorEnabled property&lt;/a&gt; combines three values to tell you whether custom errors are enabled for a particular request. This isn't as simple as reading the web.config file to check the &amp;lt;customErrors&amp;gt; section. There's a bit more going on behind the scenes to truly determine whether custom errors are enabled.&lt;/p&gt;  &lt;p&gt;The property looks at these three values:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;The &lt;a href="http://msdn.microsoft.com/en-us/library/ms228298(VS.80).aspx"&gt;web.config's &amp;lt;deployment&amp;gt; section's retail property&lt;/a&gt;. This is a useful property to set when deploying your application to a production server. This overrides any other settings for custom errors.&lt;/li&gt;    &lt;li&gt;The &lt;a href="http://msdn.microsoft.com/en-us/library/h0hfz6fc.aspx"&gt;web.config's &amp;lt;customErrors&amp;gt; section's mode property&lt;/a&gt;. This setting indicates whether custom errors are enabled at all, and if so whether they are enabled only for remote requests.&lt;/li&gt;    &lt;li&gt;The &lt;a href="http://msdn.microsoft.com/en-us/library/system.web.httprequest.islocal.aspx"&gt;HttpRequest object's IsLocal property&lt;/a&gt;. If custom errors are enabled only for remote requests, you need to know whether the request is from a remote computer.&lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;The property is used in several places in ASP.NET to determine what type of error message to display to the user. When custom errors are enabled, the error messages tend to be terse so as not to disclose any secret information. When custom errors are disabled, more extensive information is displayed to the user including stack traces, type names, and file paths. One of the nice things about this property is that it works in all trust levels (well, at least Medium trust and higher - I'm not sure about Low and Minimal). It's also nice that you don't have to worry about reading from web.config manually.&lt;/p&gt;  &lt;p&gt;Just recently in &lt;a href="http://www.asp.net/mvc/"&gt;ASP.NET MVC&lt;/a&gt; we added a feature where we used this property to determine whether to show a generic error message such as &amp;quot;Your site is broken!&amp;quot; instead of full stack traces and debugging information. I hope this property ends up getting called by your ASP.NET applications and controls!&lt;/p&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=6398779" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/leftslipper/archive/tags/ASP.NET/default.aspx">ASP.NET</category></item><item><title>MVC: Unit testing controller actions that use TempData</title><link>http://weblogs.asp.net/leftslipper/archive/2008/04/13/mvc-unit-testing-controller-actions-that-use-tempdata.aspx</link><pubDate>Mon, 14 Apr 2008 04:00:52 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:6095674</guid><dc:creator>Eilon</dc:creator><slash:comments>10</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/leftslipper/rsscomments.aspx?PostID=6095674</wfw:commentRss><comments>http://weblogs.asp.net/leftslipper/archive/2008/04/13/mvc-unit-testing-controller-actions-that-use-tempdata.aspx#comments</comments><description>&lt;p&gt;&lt;/p&gt;  &lt;p&gt;Part of the &amp;quot;big deal&amp;quot; about &lt;a href="http://www.asp.net/mvc"&gt;ASP.NET MVC&lt;/a&gt;, and of course MVC in general, is that the code you write is more easily unit tested as compared to traditional ASP.NET WebForms. However, if you've used ASP.NET MVC and tried to write a unit test for a controller action that uses TempData, you probably got some exceptions about null references and other crazy stuff. I've seen a number of solutions out there that involve private reflection (which is kind of evil) so I figured I'd show how it can be done without that trickery. (Kudos, though, to those of you who figured out how to do such trickery!)&lt;/p&gt;  &lt;p&gt;The underlying problem is that the TempDataDictionary object tries to read from session state when it's first used. At unit test time ASP.NET is not running so there isn't any session state. The solution is to provide a mock session state object to the TempDataDictionary. We're basically telling TempDataDictionary, &amp;quot;Hey you want some session state??? Here's your session state!!!&amp;quot;&lt;/p&gt;  &lt;p&gt;The controller we're going to test has two actions. The first action adds a value to TempData and then does a redirect. The second action checks for the existence of the value in TempData and renders a view.&lt;/p&gt;  &lt;pre class="code"&gt;&lt;span style="color: blue"&gt;public class &lt;/span&gt;&lt;span style="color: #2b91af"&gt;HomeController &lt;/span&gt;: &lt;span style="color: #2b91af"&gt;Controller &lt;/span&gt;{
    &lt;span style="color: blue"&gt;public void &lt;/span&gt;Index() {
        &lt;span style="color: green"&gt;// Save UserID into TempData and redirect to greeting page
        &lt;/span&gt;TempData[&lt;span style="color: #a31515"&gt;&amp;quot;UserID&amp;quot;&lt;/span&gt;] = &lt;span style="color: #a31515"&gt;&amp;quot;user123&amp;quot;&lt;/span&gt;;
        RedirectToAction(&lt;span style="color: #a31515"&gt;&amp;quot;GreetUser&amp;quot;&lt;/span&gt;);
    }

    &lt;span style="color: blue"&gt;public void &lt;/span&gt;GreetUser() {
        &lt;span style="color: green"&gt;// Check that the UserID is present. If it's not
        // there, redirect to error page. If it is, show
        // the greet user view.
        &lt;/span&gt;&lt;span style="color: blue"&gt;if &lt;/span&gt;(!TempData.ContainsKey(&lt;span style="color: #a31515"&gt;&amp;quot;UserID&amp;quot;&lt;/span&gt;)) {
            RedirectToAction(&lt;span style="color: #a31515"&gt;&amp;quot;ErrorPage&amp;quot;&lt;/span&gt;);
            &lt;span style="color: blue"&gt;return&lt;/span&gt;;
        }
        ViewData[&lt;span style="color: #a31515"&gt;&amp;quot;NewUserID&amp;quot;&lt;/span&gt;] = TempData[&lt;span style="color: #a31515"&gt;&amp;quot;UserID&amp;quot;&lt;/span&gt;];
        RenderView(&lt;span style="color: #a31515"&gt;&amp;quot;GreetUser&amp;quot;&lt;/span&gt;);
    }
}&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

&lt;p&gt;In order to write the unit tests I created a mock HttpContext with a mock session state object:&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color: green"&gt;// HttpContext for TempData that uses a custom
// session object.
&lt;/span&gt;&lt;span style="color: blue"&gt;public class &lt;/span&gt;&lt;span style="color: #2b91af"&gt;TestTempDataHttpContext &lt;/span&gt;: &lt;span style="color: #2b91af"&gt;HttpContextBase &lt;/span&gt;{
    &lt;span style="color: blue"&gt;private &lt;/span&gt;&lt;span style="color: #2b91af"&gt;TestTempDataHttpSessionState &lt;/span&gt;_sessionState =
        &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;TestTempDataHttpSessionState&lt;/span&gt;();

    &lt;span style="color: blue"&gt;public override &lt;/span&gt;&lt;span style="color: #2b91af"&gt;HttpSessionStateBase &lt;/span&gt;Session {
        &lt;span style="color: blue"&gt;get &lt;/span&gt;{
            &lt;span style="color: blue"&gt;return &lt;/span&gt;_sessionState;
        }
    }
}

&lt;span style="color: green"&gt;// HttpSessionState for TempData that uses a custom
// session object.
&lt;/span&gt;&lt;span style="color: blue"&gt;public class &lt;/span&gt;&lt;span style="color: #2b91af"&gt;TestTempDataHttpSessionState &lt;/span&gt;: &lt;span style="color: #2b91af"&gt;HttpSessionStateBase &lt;/span&gt;{
    &lt;span style="color: green"&gt;// This string is &amp;quot;borrowed&amp;quot; from the ASP.NET MVC source code
    &lt;/span&gt;&lt;span style="color: blue"&gt;private string &lt;/span&gt;TempDataSessionStateKey = &lt;span style="color: #a31515"&gt;&amp;quot;__ControllerTempData&amp;quot;&lt;/span&gt;;
    &lt;span style="color: blue"&gt;private object &lt;/span&gt;_tempDataObject;

    &lt;span style="color: blue"&gt;public override object this&lt;/span&gt;[&lt;span style="color: blue"&gt;string &lt;/span&gt;name] {
        &lt;span style="color: blue"&gt;get &lt;/span&gt;{
            &lt;span style="color: #2b91af"&gt;Assert&lt;/span&gt;.AreEqual&amp;lt;&lt;span style="color: blue"&gt;string&lt;/span&gt;&amp;gt;(
                TempDataSessionStateKey,
                name,
                &lt;span style="color: #a31515"&gt;&amp;quot;Wrong session key used&amp;quot;&lt;/span&gt;);
            &lt;span style="color: blue"&gt;return &lt;/span&gt;_tempDataObject;
        }
        &lt;span style="color: blue"&gt;set &lt;/span&gt;{
            &lt;span style="color: #2b91af"&gt;Assert&lt;/span&gt;.AreEqual&amp;lt;&lt;span style="color: blue"&gt;string&lt;/span&gt;&amp;gt;(
                TempDataSessionStateKey,
                name,
                &lt;span style="color: #a31515"&gt;&amp;quot;Wrong session key used&amp;quot;&lt;/span&gt;);
            _tempDataObject = &lt;span style="color: blue"&gt;value&lt;/span&gt;;
        }
    }
}&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;Each unit test that involves an action that uses TempData needs to create a custom TestTempDataHttpContext object and use that in a new instance of TempDataDictionary:

&lt;pre class="code"&gt;&lt;span style="color: #2b91af"&gt;TestTempDataHttpContext &lt;/span&gt;tempDataHttpContext = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;TestTempDataHttpContext&lt;/span&gt;();
homeController.TempData = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;TempDataDictionary&lt;/span&gt;(tempDataHttpContext);&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

&lt;p&gt;I wrote three unit tests for HomeController:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;Test that the Index action sets the right TempData and does a redirect&lt;/li&gt;

  &lt;li&gt;Test that the GreetUser action redirects when the TempData is missing the value&lt;/li&gt;

  &lt;li&gt;Test that the GreetUser action renders the GreetUser view with the right ViewData when the TempData has the right value&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;And here are the unit tests:&lt;/p&gt;

&lt;pre class="code"&gt;[&lt;span style="color: #2b91af"&gt;TestClass&lt;/span&gt;]
&lt;span style="color: blue"&gt;public class &lt;/span&gt;&lt;span style="color: #2b91af"&gt;HomeControllerTest &lt;/span&gt;{
    [&lt;span style="color: #2b91af"&gt;TestMethod&lt;/span&gt;]
    &lt;span style="color: blue"&gt;public void &lt;/span&gt;IndexSavesUserIDToTempDataAndRedirects() {
        &lt;span style="color: green"&gt;// Setup
        &lt;/span&gt;&lt;span style="color: #2b91af"&gt;TestHomeController &lt;/span&gt;homeController = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;TestHomeController&lt;/span&gt;();
        &lt;span style="color: #2b91af"&gt;TestTempDataHttpContext &lt;/span&gt;tempDataHttpContext = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;TestTempDataHttpContext&lt;/span&gt;();
        homeController.TempData = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;TempDataDictionary&lt;/span&gt;(tempDataHttpContext);

        &lt;span style="color: green"&gt;// Execute
        &lt;/span&gt;homeController.Index();

        &lt;span style="color: green"&gt;// Verify
        &lt;/span&gt;&lt;span style="color: #2b91af"&gt;Assert&lt;/span&gt;.IsTrue(homeController.RedirectValues.ContainsKey(&lt;span style="color: #a31515"&gt;&amp;quot;action&amp;quot;&lt;/span&gt;));
        &lt;span style="color: #2b91af"&gt;Assert&lt;/span&gt;.AreEqual(&lt;span style="color: #a31515"&gt;&amp;quot;GreetUser&amp;quot;&lt;/span&gt;, homeController.RedirectValues[&lt;span style="color: #a31515"&gt;&amp;quot;action&amp;quot;&lt;/span&gt;]);

        &lt;span style="color: #2b91af"&gt;Assert&lt;/span&gt;.IsTrue(homeController.TempData.ContainsKey(&lt;span style="color: #a31515"&gt;&amp;quot;UserID&amp;quot;&lt;/span&gt;));
        &lt;span style="color: #2b91af"&gt;Assert&lt;/span&gt;.AreEqual(&lt;span style="color: #a31515"&gt;&amp;quot;user123&amp;quot;&lt;/span&gt;, homeController.TempData[&lt;span style="color: #a31515"&gt;&amp;quot;UserID&amp;quot;&lt;/span&gt;]);
    }

    [&lt;span style="color: #2b91af"&gt;TestMethod&lt;/span&gt;]
    &lt;span style="color: blue"&gt;public void &lt;/span&gt;GreetUserWithNoUserIDRedirects() {
        &lt;span style="color: green"&gt;// Setup
        &lt;/span&gt;&lt;span style="color: #2b91af"&gt;TestHomeController &lt;/span&gt;homeController = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;TestHomeController&lt;/span&gt;();
        &lt;span style="color: #2b91af"&gt;TestTempDataHttpContext &lt;/span&gt;tempDataHttpContext = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;TestTempDataHttpContext&lt;/span&gt;();
        homeController.TempData = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;TempDataDictionary&lt;/span&gt;(tempDataHttpContext);

        &lt;span style="color: green"&gt;// Execute
        &lt;/span&gt;homeController.GreetUser();

        &lt;span style="color: green"&gt;// Verify
        &lt;/span&gt;&lt;span style="color: #2b91af"&gt;Assert&lt;/span&gt;.IsTrue(homeController.RedirectValues.ContainsKey(&lt;span style="color: #a31515"&gt;&amp;quot;action&amp;quot;&lt;/span&gt;));
        &lt;span style="color: #2b91af"&gt;Assert&lt;/span&gt;.AreEqual(&lt;span style="color: #a31515"&gt;&amp;quot;ErrorPage&amp;quot;&lt;/span&gt;, homeController.RedirectValues[&lt;span style="color: #a31515"&gt;&amp;quot;action&amp;quot;&lt;/span&gt;]);

        &lt;span style="color: #2b91af"&gt;Assert&lt;/span&gt;.AreEqual(0, homeController.TempData.Count);
    }

    [&lt;span style="color: #2b91af"&gt;TestMethod&lt;/span&gt;]
    &lt;span style="color: blue"&gt;public void &lt;/span&gt;GreetUserWithUserIDCopiesToViewDataAndRenders() {
        &lt;span style="color: green"&gt;// Setup
        &lt;/span&gt;&lt;span style="color: #2b91af"&gt;TestHomeController &lt;/span&gt;homeController = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;TestHomeController&lt;/span&gt;();
        &lt;span style="color: #2b91af"&gt;TestTempDataHttpContext &lt;/span&gt;tempDataHttpContext = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;TestTempDataHttpContext&lt;/span&gt;();
        homeController.TempData = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;TempDataDictionary&lt;/span&gt;(tempDataHttpContext);
        homeController.TempData[&lt;span style="color: #a31515"&gt;&amp;quot;UserID&amp;quot;&lt;/span&gt;] = &lt;span style="color: #a31515"&gt;&amp;quot;TestUserID&amp;quot;&lt;/span&gt;;

        &lt;span style="color: green"&gt;// Execute
        &lt;/span&gt;homeController.GreetUser();

        &lt;span style="color: green"&gt;// Verify
        &lt;/span&gt;&lt;span style="color: #2b91af"&gt;Assert&lt;/span&gt;.AreEqual&amp;lt;&lt;span style="color: blue"&gt;string&lt;/span&gt;&amp;gt;(&lt;span style="color: #a31515"&gt;&amp;quot;GreetUser&amp;quot;&lt;/span&gt;, homeController.RenderViewName);
        &lt;span style="color: #2b91af"&gt;Assert&lt;/span&gt;.AreEqual&amp;lt;&lt;span style="color: blue"&gt;string&lt;/span&gt;&amp;gt;(&lt;span style="color: #2b91af"&gt;String&lt;/span&gt;.Empty, homeController.RenderMasterName);
        &lt;span style="color: #2b91af"&gt;IDictionary&lt;/span&gt;&amp;lt;&lt;span style="color: blue"&gt;string&lt;/span&gt;, &lt;span style="color: blue"&gt;object&lt;/span&gt;&amp;gt; viewData =
            homeController.RenderViewData &lt;span style="color: blue"&gt;as &lt;/span&gt;&lt;span style="color: #2b91af"&gt;IDictionary&lt;/span&gt;&amp;lt;&lt;span style="color: blue"&gt;string&lt;/span&gt;, &lt;span style="color: blue"&gt;object&lt;/span&gt;&amp;gt;;
        &lt;span style="color: #2b91af"&gt;Assert&lt;/span&gt;.IsNotNull(viewData);
        &lt;span style="color: #2b91af"&gt;Assert&lt;/span&gt;.IsTrue(viewData.ContainsKey(&lt;span style="color: #a31515"&gt;&amp;quot;NewUserID&amp;quot;&lt;/span&gt;));
        &lt;span style="color: #2b91af"&gt;Assert&lt;/span&gt;.AreEqual(&lt;span style="color: #a31515"&gt;&amp;quot;TestUserID&amp;quot;&lt;/span&gt;, viewData[&lt;span style="color: #a31515"&gt;&amp;quot;NewUserID&amp;quot;&lt;/span&gt;]);
    }

    &lt;span style="color: green"&gt;// Test-specific subclass for HomeController. This won't be
    // needed in the next release of ASP.NET MVC.
    &lt;/span&gt;&lt;span style="color: blue"&gt;private sealed class &lt;/span&gt;&lt;span style="color: #2b91af"&gt;TestHomeController &lt;/span&gt;: &lt;span style="color: #2b91af"&gt;HomeController &lt;/span&gt;{
        &lt;span style="color: blue"&gt;public &lt;/span&gt;&lt;span style="color: #2b91af"&gt;RouteValueDictionary &lt;/span&gt;RedirectValues;
        &lt;span style="color: blue"&gt;public string &lt;/span&gt;RenderViewName;
        &lt;span style="color: blue"&gt;public string &lt;/span&gt;RenderMasterName;
        &lt;span style="color: blue"&gt;public object &lt;/span&gt;RenderViewData;

        &lt;span style="color: blue"&gt;protected override void &lt;/span&gt;RedirectToAction(&lt;span style="color: #2b91af"&gt;RouteValueDictionary &lt;/span&gt;values) {
            RedirectValues = values;
        }

        &lt;span style="color: blue"&gt;protected override void &lt;/span&gt;RenderView(&lt;span style="color: blue"&gt;string &lt;/span&gt;viewName, &lt;span style="color: blue"&gt;string &lt;/span&gt;masterName,
            &lt;span style="color: blue"&gt;object &lt;/span&gt;viewData) {
            RenderViewName = viewName;
            RenderMasterName = masterName;
            RenderViewData = viewData;
        }
    }
}&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

&lt;p&gt;Some notes about the code:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;For the unit tests I also needed to create a &lt;a href="http://haacked.com/archive/2007/12/06/test-specific-subclasses-vs-partial-mocks.aspx"&gt;test-specific subclass&lt;/a&gt; for HomeController called TestHomeController in order to capture the values of a call to RedirectToAction and RenderView. In the upcoming preview of ASP.NET MVC this class won't be needed due to some changes we've made.&lt;/li&gt;

  &lt;li&gt;Making TempData easier to unit test is on our list of improvements for a later preview of ASP.NET MVC. We realize it's a bit tricky right now, and we plan to make it much, much easier.&lt;/li&gt;

  &lt;li&gt;Instead of creating concrete classes for the custom HttpContext and session state objects you could use a mock object framework to dynamically generate those instances. I chose not to show that since it might detract from the purpose of the post. If you're already using a mock object framework such as &lt;a href="http://www.ayende.com/projects/rhino-mocks.aspx"&gt;RhinoMocks&lt;/a&gt; or &lt;a href="http://code.google.com/p/moq/"&gt;Moq&lt;/a&gt; it should be easy to modify the code to use those frameworks.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I hope you find this sample useful when you're writing your unit tests. If you have any other pain points in ASP.NET MVC please post a comment so we'll know about it.&lt;/p&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=6095674" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/leftslipper/archive/tags/ASP.NET/default.aspx">ASP.NET</category><category domain="http://weblogs.asp.net/leftslipper/archive/tags/unit+test/default.aspx">unit test</category><category domain="http://weblogs.asp.net/leftslipper/archive/tags/MVC/default.aspx">MVC</category><category domain="http://weblogs.asp.net/leftslipper/archive/tags/aspnetmvc/default.aspx">aspnetmvc</category></item><item><title>MVC: Locking the RouteCollection</title><link>http://weblogs.asp.net/leftslipper/archive/2008/03/31/mvc-locking-the-routecollection.aspx</link><pubDate>Mon, 31 Mar 2008 22:00:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:6050563</guid><dc:creator>Eilon</dc:creator><slash:comments>10</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/leftslipper/rsscomments.aspx?PostID=6050563</wfw:commentRss><comments>http://weblogs.asp.net/leftslipper/archive/2008/03/31/mvc-locking-the-routecollection.aspx#comments</comments><description>&lt;P&gt;Since the advent of multithreaded programming, the responsibility of locking collections has always been a contentious issue. Who should lock the collection? When should it be locked? And for how long? The ASP.NET Routing feature that is used by the MVC framework involves a thread-safe collection that contains the list of the application's route definitions. Will your routes be safe? Continue reading to find out (on this amazing journey (into the depths of the RouteCollection)). How's that for a cheesy intro?&lt;/P&gt;
&lt;H1&gt;The problem&lt;/H1&gt;
&lt;P&gt;When the first preview of ASP.NET MVC was released last December, some &lt;A href="http://abombss.com/blog/2007/12/19/ms-mvc-routing-the-good-the-bad-the-restful/" mce_href="http://abombss.com/blog/2007/12/19/ms-mvc-routing-the-good-the-bad-the-restful/"&gt;people&lt;/A&gt; &lt;A href="http://forums.asp.net/t/1194755.aspx" mce_href="http://forums.asp.net/t/1194755.aspx"&gt;noted&lt;/A&gt; that the RouteCollection would lock itself during all read and write operations, which could cause major performance and scaling issues. Well, sort of. The RouteCollection class derives from the generic &lt;A href="http://msdn2.microsoft.com/en-us/library/ms132397.aspx" mce_href="http://msdn2.microsoft.com/en-us/library/ms132397.aspx"&gt;Collection&amp;lt;T&amp;gt;&lt;/A&gt;, which has a few virtual methods it calls when write operations are performed. Each of those methods was overridden in RouteCollection to take a full lock. The route operations of matching routes to incoming requests and generating URLs also took the same full lock. There were two problems (at least) with this approach:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Taking a full lock means that if anyone is using the collection, any other operation on that collection would have to wait for the first one to be done. Even if two requests just wanted to enumerate the collection (a read-only operation), one request would have to wait. This wasn't a logic bug since it wouldn't prevent anything from working; It was just a performance issue. There was in fact a comment in the code along the lines of "TODO: Shouldn't we use a ReaderWriterLockSlim here or something?" &lt;/LI&gt;
&lt;LI&gt;We weren't locking enough! If someone directly enumerated the collection by calling GetEnumerator (which happens implicitly when you use C# or VB's foreach statement), no lock would be taken. Unfortunately, Collection&amp;lt;T&amp;gt; does not offer any virtual methods that get called during read operations. &lt;/LI&gt;&lt;/OL&gt;
&lt;H1&gt;The solution (or so we thought)&lt;/H1&gt;
&lt;P&gt;We knew we had to do something for &lt;A href="http://www.asp.net/mvc/" mce_href="http://www.asp.net/mvc/"&gt;ASP.NET MVC Preview 2&lt;/A&gt;: We had performance problems as well as bugs in our collection locking. The first thing we did was change the lock to be a multiple-reader, single-writer lock with the &lt;A href="http://msdn2.microsoft.com/en-us/library/system.threading.readerwriterlockslim.aspx" mce_href="http://msdn2.microsoft.com/en-us/library/system.threading.readerwriterlockslim.aspx"&gt;ReaderWriterLockSlim&lt;/A&gt; class. Using this class in the RouteCollection allows any number of readers to read the collection at the same time but will fully lock the collection when a write is performed and allow only that one writer to make changes until the write lock is released.&lt;/P&gt;
&lt;P&gt;Before we knew it, though, a bug was found while running some performance tests. When there is contention for the lock, the ReaderWriterLockSlim needs to get the processor count of the server. For some reason or another, getting that count is not permitted in Medium Trust web applications and thus throws a SecurityException. We didn't notice this while we were writing unit tests and web tests because all those tests are single threaded: there is never any contention for the lock.&lt;/P&gt;
&lt;H1&gt;&lt;/H1&gt;
&lt;H1&gt;The final solution&lt;/H1&gt;
&lt;P&gt;We opened a work item for the owners of Environment.ProcessorCount to remove the security requirement since knowing the processor count of the host is hardly top secret information. However, since the ASP.NET Routing feature works on .NET Framework 3.5, bug fixes in a future version wouldn't be sufficient. Thus we changed RouteCollection to use ReaderWriterLock, which is slightly less performant, but works in all web trust levels.&lt;/P&gt;
&lt;P&gt;So we solved the problem of when the collection gets locked and for how long. But what about the very first issue I mentioned: Who should lock the collection?&lt;/P&gt;
&lt;P&gt;Our first solution was to do all the locking internally. Any time you called any member on the collection we'd take the appropriate lock. This meant implementing IList&amp;lt;T&amp;gt; directly since neither Collection&amp;lt;T&amp;gt; nor List&amp;lt;T&amp;gt; provide the necessary hooks. This proved to be a lot of work (but not for me, since I didn't have to write it &lt;IMG alt=smile_regular src="http://spaces.live.com/rte/emoticons/smile_regular.gif" mce_src="http://spaces.live.com/rte/emoticons/smile_regular.gif"&gt;) and left some big holes of functionality. For example, how could someone atomically search for a route in the collection, remove it, and add a new route?&lt;/P&gt;
&lt;P&gt;The solution to that problem was to expose the lock semantics publicly, though without exposing the lock object itself. Thus the RouteCollection has two new methods: GetReadLock and GetWriteLock. Developers can call those methods to get the lock that the RouteCollection uses internally and cooperate with its locking mechanism. However, you only need to get the lock if you're directly accessing the collection. If you're going through any of the typical "end-user" API calls, we do the locking automatically. For example, calling Html.ActionLink, Url.Action, and RouteCollection.GetVirtualPath will automatically lock the collection.&lt;/P&gt;
&lt;P&gt;In case you're wondering, there were several reasons we chose not to expose the lock object itself:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;We wanted to be able to change the lock implementation at any time. This would let us switch back to ReaderWriterLockSlim at some point in the future. &lt;/LI&gt;
&lt;LI&gt;It seemed simpler for users to have a limited API surface. Less is More. &lt;/LI&gt;
&lt;LI&gt;It encourages users to use the dispose pattern with the lock they get, thus ensuring that the lock is released even if an exception is thrown and not caught while the lock is being held. &lt;/LI&gt;&lt;/OL&gt;
&lt;H1&gt;Why you should care&lt;/H1&gt;
&lt;P&gt;There are two takeaways I hope I provided in this article:&lt;/P&gt;
&lt;P&gt;The first takeaway is that if you're implementing a thread-safe collection you have some food for thought. I hope the food was easy to digest!&lt;/P&gt;
&lt;P&gt;The second takeaway is that if you're directly accessing the RouteCollection in an ASP.NET application, make sure you take the lock first! Taking the lock is easy with the dispose pattern:&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Lucida Console"&gt;RouteCollection routes = RouteTable.Routes; &lt;BR&gt;using (routes.GetReadLock()) { &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; foreach (RouteBase route in routes) { &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Do something interesting here and be guaranteed that no one is modifying the collection &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; } &lt;BR&gt;} &lt;BR&gt;// The lock is now released since we exited the "using" statement.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;Who would have thought that a simple collection of routes would turn out to be so much fun? Did you ever start coding something that seemed simple and ended up writing a long blog post about it?&lt;/P&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=6050563" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/leftslipper/archive/tags/ASP.NET/default.aspx">ASP.NET</category><category domain="http://weblogs.asp.net/leftslipper/archive/tags/MVC/default.aspx">MVC</category><category domain="http://weblogs.asp.net/leftslipper/archive/tags/aspnetmvc/default.aspx">aspnetmvc</category></item><item><title>MVC: I'll need a little bit more context on that</title><link>http://weblogs.asp.net/leftslipper/archive/2008/02/18/mvc-context.aspx</link><pubDate>Tue, 19 Feb 2008 00:00:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:5816702</guid><dc:creator>Eilon</dc:creator><slash:comments>4</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/leftslipper/rsscomments.aspx?PostID=5816702</wfw:commentRss><comments>http://weblogs.asp.net/leftslipper/archive/2008/02/18/mvc-context.aspx#comments</comments><description>&lt;P&gt;&lt;A href="http://weblogs.asp.net/scottgu/archive/2008/02/12/asp-net-mvc-framework-road-map-update.aspx" mce_href="http://weblogs.asp.net/scottgu/archive/2008/02/12/asp-net-mvc-framework-road-map-update.aspx"&gt;ScottGu recently announced&lt;/A&gt; the plans for the next public preview of the ASP.NET MVC framework. For those who don't feel like clicking on links to other peoples' blog posts Scott's blog says it's being released at &lt;A class="" href="http://www.visitmix.com/" mce_href="http://www.visitmix.com/"&gt;MIX08&lt;/A&gt;, which is only a couple of weeks away. And yes, I will be there!&lt;/P&gt;
&lt;P&gt;My previous blog post talked in general about the &lt;A href="http://weblogs.asp.net/leftslipper/archive/2007/12/10/asp-net-mvc-design-philosophy.aspx" mce_href="http://weblogs.asp.net/leftslipper/archive/2007/12/10/asp-net-mvc-design-philosophy.aspx"&gt;design philosophy&lt;/A&gt; of the ASP.NET MVC framework. Today I'd like to talk specifically about context objects, how we use them in ASP.NET MVC, and why we like them. In the coming release of MVC there will be about seven context types throughout ASP.NET, URL routing, and MVC.&lt;/P&gt;
&lt;H2&gt;What is a Context Object?&lt;/H2&gt;
&lt;P&gt;A context object is exactly that: An object that gives another object some information about what's going on. Information such as what is the current request, what task is being performed, and sometimes even the ability the change what's going on.&lt;/P&gt;
&lt;H2&gt;Context in MVC&lt;/H2&gt;
&lt;P&gt;One context object many ASP.NET developers are already familiar with is &lt;A href="http://msdn2.microsoft.com/en-us/library/system.web.httpcontext.aspx" mce_href="http://msdn2.microsoft.com/en-us/library/system.web.httpcontext.aspx"&gt;HttpContext&lt;/A&gt;. HttpContext gives you everything you need to know about the current request, who's making that request, and how to respond to the request. Of course, in MVC we decoupled the MVC framework from the test-unfriendly HttpContext by introducing an IHttpContext interface (which, by the way, is now an HttpContextBase abstract base class for future-proofing purposes).&lt;/P&gt;
&lt;P&gt;However, as the request gets processed we create and gather up additional information about what's going on. The first context we add is at the routing level: the RequestContext type. It adds just one piece of information, the RouteData, as well as including all previous context information, which is just the HttpContextBase.&lt;/P&gt;
&lt;P&gt;Once a route is selected and we determine that it is an MVC request, we're off to the controller. This is where the ControllerContext comes in to the picture. ControllerContext derives from RequestContext and adds the controller instance to it. We then have a ViewContext type, which adds information about the selected view, its view data, and some other items.&lt;/P&gt;
&lt;P&gt;One of the new features in the upcoming preview is action filters, and sure enough there are three filter context types as well.&lt;/P&gt;
&lt;P&gt;Since the context types derive from one another (except for HttpContextBase), you can often pass in whatever context type you have to call some method from a lower level. For example, in the view you get a ViewContext that you can pass into the URL routing methods.&lt;/P&gt;
&lt;H2&gt;What Can Context Do For You?&lt;/H2&gt;
&lt;P&gt;By passing around context objects we have no need for global state. Global state would be something like a static property or field that everyone can get to. One of the typical requirements of a unit test is that during their execution they do not consume global state nor do they alter global state. We give you the context object and it has everything you need to know. How do I know that it's everything you need to know? Quite simply, the context object is all &lt;EM&gt;we&lt;/EM&gt; know anyway, so we're just letting &lt;EM&gt;you&lt;/EM&gt; know about it as well.&lt;/P&gt;
&lt;P&gt;Since your code now makes its decisions and operates on a passed-in context object, your unit tests can produce fake contexts and pass those in to your methods to see how the code reacts to them. You no longer have to worry about your code depending on global state since there simply isn't any (at least none that we create).&lt;/P&gt;
&lt;P&gt;Have I given you enough context on what we're doing?&lt;/P&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=5816702" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/leftslipper/archive/tags/ASP.NET/default.aspx">ASP.NET</category><category domain="http://weblogs.asp.net/leftslipper/archive/tags/unit+test/default.aspx">unit test</category><category domain="http://weblogs.asp.net/leftslipper/archive/tags/MVC/default.aspx">MVC</category><category domain="http://weblogs.asp.net/leftslipper/archive/tags/aspnetmvc/default.aspx">aspnetmvc</category></item><item><title>ASP.NET MVC Design Philosophy</title><link>http://weblogs.asp.net/leftslipper/archive/2007/12/10/asp-net-mvc-design-philosophy.aspx</link><pubDate>Tue, 11 Dec 2007 02:00:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:5434791</guid><dc:creator>Eilon</dc:creator><slash:comments>38</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/leftslipper/rsscomments.aspx?PostID=5434791</wfw:commentRss><comments>http://weblogs.asp.net/leftslipper/archive/2007/12/10/asp-net-mvc-design-philosophy.aspx#comments</comments><description>&lt;P&gt;&lt;FONT size=3&gt;This week the first preview of the ASP.NET MVC framework was released to the web as part of the &lt;A href="http://asp.net/downloads/3.5-extensions/" mce_href="http://asp.net/downloads/3.5-extensions/"&gt;ASP.NET 3.5 Extensions CTP Preview&lt;/A&gt;. It's been a few months since we started coding and as the lead developer on the project I'd like to share my thoughts on the design of this framework. This isn't a post about why MVC is great. Instead, it's a post about what we did to make MVC happen in ASP.NET.&lt;/FONT&gt;&lt;/P&gt;
&lt;H2&gt;The MVC Snake&lt;/H2&gt;
&lt;P&gt;&lt;FONT size=+0&gt;One of the design strategies we used in the MVC framework is to have a clear sequence of stages in each request. The stages are reminiscent of the &lt;A href="http://msdn2.microsoft.com/en-us/library/ms178472.aspx" mce_href="http://msdn2.microsoft.com/en-us/library/ms178472.aspx"&gt;ASP.NET Page and Controls lifecycle&lt;/A&gt;, but much, much simpler. Here's a rough diagram of the stages from the slides that &lt;A href="http://www.hanselman.com/blog/DevConnectionsTheASPNETMVCFramework.aspx" mce_href="http://www.hanselman.com/blog/DevConnectionsTheASPNETMVCFramework.aspx"&gt;Scott Hanselman&lt;/A&gt; and I showed at the DevConnections conference.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size=3&gt;&lt;A href="http://weblogs.asp.net/blogs/leftslipper/WindowsLiveWriter/ASP.NETMVCDesignPhilosophy_F491/MVC_Snake_2.png" mce_href="http://weblogs.asp.net/blogs/leftslipper/WindowsLiveWriter/ASP.NETMVCDesignPhilosophy_F491/MVC_Snake_2.png"&gt;&lt;IMG style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" height=184 alt=MVC_Snake src="http://weblogs.asp.net/blogs/leftslipper/WindowsLiveWriter/ASP.NETMVCDesignPhilosophy_F491/MVC_Snake_thumb.png" width=244 border=0 mce_src="http://weblogs.asp.net/blogs/leftslipper/WindowsLiveWriter/ASP.NETMVCDesignPhilosophy_F491/MVC_Snake_thumb.png"&gt;&lt;/A&gt; &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size=3&gt;When a request comes in, it goes through the stages as shown in the diagram. There are a few more stages than are shown, but they were removed so the "MVC Snake" diagram wouldn't get too cluttered. An important aspect of this diagram is that each stage only depends on the previous stages. A given stage typically doesn't make any assumptions about what follows it.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size=3&gt;For example, the IController interface doesn't assume anything about views or any particular view factory implementation. However, views can assume that an IController was involved in their creation. The implication of this is that you can stray from our path at almost any stage and still end up with success. Want to implement a controller in some new, unique way? Go ahead!&lt;/FONT&gt;&lt;/P&gt;
&lt;H2&gt;URL Routing - Not part of MVC&lt;FONT size=3&gt;&lt;/FONT&gt;&lt;/H2&gt;
&lt;P&gt;&lt;FONT size=3&gt;Part of the MVC framework is a new URL routing mechanism. This allows you to create "friendly" and "pretty" URLs such as "http://example.org/store/categories" that map to arbitrary controller actions. There's no reason that the URL should specify a physical resource. The visitors to your site surely don't care how you architected your web site or web application.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size=3&gt;If you've downloaded the CTP you'll notice that the URL Routing types sit in the System.Web.Mvc namespace. However, the URL Routing types aren't even a part of the MVC framework. URL Routing works with arbitrary IHttpHandlers so it can serve up arbitrary requests - not just MVC requests. For the current CTP because we just couldn't find a better place so we left the types in that namespace.&lt;/FONT&gt;&lt;/P&gt;
&lt;H2&gt;New Language Features&lt;/H2&gt;
&lt;P&gt;&lt;FONT size=3&gt;We're technology addicts, and it shows. The latest version of the C# language includes several new features and we decided to take advantage of them in the MVC framework. We used &lt;/FONT&gt;&lt;FONT size=3&gt;&lt;A href="http://weblogs.asp.net/leftslipper/archive/2007/09/24/using-c-3-0-anonymous-types-as-dictionaries.aspx" mce_href="http://weblogs.asp.net/leftslipper/archive/2007/09/24/using-c-3-0-anonymous-types-as-dictionaries.aspx"&gt;anonymous types in place of dictionaries&lt;/A&gt;, extension methods for helper methods, and &lt;A href="http://blog.wekeroad.com/2007/12/05/aspnet-mvc-preview-using-the-mvc-ui-helpers/" mce_href="http://blog.wekeroad.com/2007/12/05/aspnet-mvc-preview-using-the-mvc-ui-helpers/"&gt;lambda expressions as strongly-typed URLs&lt;/A&gt;.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size=3&gt;But - and there is almost always a "but" - we went a bit too far in the current CTP. We've heard from many of you already that using anonymous types as dictionaries is cool, but hard to understand. And it doesn't have Intellisense. For the next release we're still planning on keeping those features, but we want to add more familiar ways of doing the same things. For example, we're going to let you use dictionaries when we want dictionaries. It seems obvious now. :)&lt;/FONT&gt;&lt;/P&gt;
&lt;H2&gt;Extensible, Extensible, Extensible&lt;/H2&gt;
&lt;P&gt;&lt;FONT size=3&gt;To build a framework that was extensible, testable, and functional, we had many important design decisions to make.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size=3&gt;Perhaps most importantly, we went with an interface-based design. We didn't use interfaces for &lt;EM&gt;everything&lt;/EM&gt;, but we did for most things. Typically we used i&lt;/FONT&gt;&lt;FONT size=3&gt;nterfaces for all &lt;EM&gt;behavioral &lt;/EM&gt;types, and classes for &lt;EM&gt;data objects&lt;/EM&gt;. The reason is that &lt;EM&gt;behavior &lt;/EM&gt;needs to be mocked, whereas &lt;EM&gt;data &lt;/EM&gt;is just data. Your data objects would probably look exactly the same as our implementations anyway, so we didn't want to bother with interfaces. There are always exceptions, and in the first CTP we may have made some decisions that don't agree with this, but we already have plans to address these for the next CTP.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size=3&gt;Traditionally in ASP.NET, a lot of extensibility is enabled by inheriting from our classes and overriding virtual members. While it is a valid approach, it requires that you inherit from our components even if you just want to tweak one small behavior. In the MVC framework we still have many instances of that, but we also allow you to extend our functionality using composition. For example, to modify the behavior of a controller you can either derive from it or you can use a filter to externally change its behavior. The same exception I mentioned in the previous paragraph applies here.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size=3&gt;Composition often yields better separation of concerns and allows you to more easily build cross-cutting concerns. For example, if you want to apply the same "behavior modification" to several different controller classes, you don't have to override the same virtual members in each one. You can just apply an external cross-cutting concern to the controllers you want. &lt;/FONT&gt;&lt;FONT size=3&gt;Thus, composition is more easily used with dependency injection frameworks.&lt;/FONT&gt;&lt;/P&gt;
&lt;H2&gt;What Does All This Lead To?&lt;/H2&gt;
&lt;P&gt;&lt;FONT size=3&gt;Well, what &lt;EM&gt;does&lt;/EM&gt; this all lead to? Several things, of course. For example, each of the components in the MVC framework is fairly small and self contained, with &lt;A href="http://en.wikipedia.org/wiki/Single_responsibility_principle" mce_href="http://en.wikipedia.org/wiki/Single_responsibility_principle"&gt;single responsibilities&lt;/A&gt;. This means that due to their small size you have building blocks that are easier to understand. It also means that you can replace or even alter the building blocks if they don't suit your needs.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size=3&gt;Having great amounts of extensibility means you can write unit tests for your application more easily. I remember the days when I didn't write unit tests. Dark days, they were.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size=3&gt;But who is going to use the MVC framework? Not everyone wants to write unit tests or alter so-called building blocks. Being able to drag &amp;amp; drop a GridView and a SqlDataSource onto a WebForm is a valid scenario and it will continue to work. We're trying to create a better fit for ASP.NET for certain types of individuals.&lt;/FONT&gt;&lt;/P&gt;
&lt;H2&gt;Anecdotes and Miscellany&lt;/H2&gt;
&lt;P&gt;&lt;FONT size=3&gt;And to end with some fun facts and stories, the following is all true.&lt;/FONT&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;FONT size=3&gt;For the released CTP, the unit test code coverage numbers were about 93%, far more than any other major feature area. This does not include the code coverage by our QA guys, which I'm sure would bring the number up to at least 99%.&lt;/FONT&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;FONT size=3&gt;We had about 250 unit tests for MVC, and the ratio of unit test code to product code is about 1.9 to 1 (in terms of the size of the code files, not lines of code; I'm too lazy to do the latter!).&lt;/FONT&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;FONT size=3&gt;It &lt;EM&gt;feels&lt;/EM&gt; good to unit test! I can't go back to the old ways.&lt;/FONT&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;FONT size=3&gt;Some of the code is written using true TDD, but some is code-first, but it is then quickly followed up with unit tests (prior to checking in).&lt;/FONT&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;FONT size=3&gt;Several weeks ago we invited several customers for a top secret sneak preview of the CTP, including the MVC framework. &lt;A href="http://www.jeffreypalermo.com/" mce_href="http://www.jeffreypalermo.com/"&gt;Jeffrey Palermo&lt;/A&gt; was attending and trying to build some samples with the MVC framework. Sure enough, he encountered some bugs in the product. The bits were still hot off the press and some of the bits hadn't quite settled in the right place. Millions of ones and zeros - what are the odds they'd all line up correctly on the first try? Anyway, I sat with Jeffrey for about half an hour and we managed to use many of the extensibility points in the framework to work around the bugs he encountered. The whole time I kept thinking (and probably saying aloud) that I was &lt;EM&gt;so&lt;/EM&gt; glad I made those methods public or virtual or whatever! Without them Jeffrey would have been stuck.&lt;/FONT&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;FONT size=3&gt;The moral of the story: If you aren't sure, make it public. If &lt;EM&gt;we &lt;/EM&gt;have to use a method, chances are, someone &lt;EM&gt;else &lt;/EM&gt;does too.&lt;/FONT&gt;&lt;/LI&gt;&lt;/UL&gt;
&lt;H2&gt;MVC Resources&lt;/H2&gt;
&lt;P&gt;&lt;FONT size=3&gt;Downloads:&lt;/FONT&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;FONT size=3&gt;&lt;A href="http://asp.net/downloads/3.5-extensions/" mce_href="http://asp.net/downloads/3.5-extensions/"&gt;Microsoft ASP.NET 3.5 Extensions Preview&lt;/A&gt; (the framework, which includes the MVC framework)&lt;/FONT&gt; &lt;/LI&gt;
&lt;LI&gt;&lt;FONT size=3&gt;&lt;A href="http://asp.net/downloads/3.5-extensions/MVCToolkit.zip" mce_href="http://asp.net/downloads/3.5-extensions/MVCToolkit.zip"&gt;MVC Toolkit Extras&lt;/A&gt; (lots of helpers methods for MVC)&lt;/FONT&gt; &lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;&lt;FONT size=3&gt;Documentation and discussion forums:&lt;/FONT&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;FONT size=3&gt;&lt;A href="http://quickstarts.asp.net/3-5-extensions/" mce_href="http://quickstarts.asp.net/3-5-extensions/"&gt;QuickStart Documentation&lt;/A&gt;&lt;/FONT&gt; &lt;/LI&gt;
&lt;LI&gt;&lt;FONT size=3&gt;&lt;A href="http://forums.asp.net/1146.aspx" mce_href="http://forums.asp.net/1146.aspx"&gt;ASP.NET MVC Forum&lt;/A&gt;&lt;/FONT&gt; &lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;&lt;FONT size=3&gt;Blog posts and videos by team members:&lt;/FONT&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;FONT size=3&gt;ScottGu: &lt;/FONT&gt;&lt;A href="http://weblogs.asp.net/scottgu/archive/2007/10/14/asp-net-mvc-framework.aspx" mce_href="http://weblogs.asp.net/scottgu/archive/2007/10/14/asp-net-mvc-framework.aspx"&gt;&lt;FONT size=3&gt;ASP.NET MVC Framework (Part 0): What is it?&lt;/FONT&gt;&lt;/A&gt; &lt;/LI&gt;
&lt;LI&gt;&lt;FONT size=3&gt;ScottGu: &lt;/FONT&gt;&lt;A href="http://weblogs.asp.net/scottgu/archive/2007/11/13/asp-net-mvc-framework-part-1.aspx" mce_href="http://weblogs.asp.net/scottgu/archive/2007/11/13/asp-net-mvc-framework-part-1.aspx"&gt;&lt;FONT size=3&gt;ASP.NET MVC Framework (Part 1): Building an MVC Application&lt;/FONT&gt;&lt;/A&gt; &lt;/LI&gt;
&lt;LI&gt;&lt;FONT size=3&gt;ScottGu: &lt;/FONT&gt;&lt;A href="http://weblogs.asp.net/scottgu/archive/2007/12/03/asp-net-mvc-framework-part-2-url-routing.aspx" mce_href="http://weblogs.asp.net/scottgu/archive/2007/12/03/asp-net-mvc-framework-part-2-url-routing.aspx"&gt;&lt;FONT size=3&gt;ASP.NET MVC Framework (Part 2): URL Routing&lt;/FONT&gt;&lt;/A&gt; &lt;/LI&gt;
&lt;LI&gt;&lt;FONT size=3&gt;ScottGu: &lt;/FONT&gt;&lt;A href="http://weblogs.asp.net/scottgu/archive/2007/12/06/asp-net-mvc-framework-part-3-passing-viewdata-from-controllers-to-views.aspx" mce_href="http://weblogs.asp.net/scottgu/archive/2007/12/06/asp-net-mvc-framework-part-3-passing-viewdata-from-controllers-to-views.aspx"&gt;&lt;FONT size=3&gt;ASP.NET MVC Framework (Part 3): Passing ViewData from Controllers to Views&lt;/FONT&gt;&lt;/A&gt; &lt;/LI&gt;
&lt;LI&gt;&lt;FONT size=3&gt;ScottGu: &lt;/FONT&gt;&lt;A href="http://weblogs.asp.net/scottgu/archive/2007/12/09/asp-net-mvc-framework-part-4-handling-form-edit-and-post-scenarios.aspx" mce_href="http://weblogs.asp.net/scottgu/archive/2007/12/09/asp-net-mvc-framework-part-4-handling-form-edit-and-post-scenarios.aspx"&gt;&lt;FONT size=3&gt;ASP.NET MVC Framework (Part 4): Handling Form Edit and Post Scenarios&lt;/FONT&gt;&lt;/A&gt; &lt;/LI&gt;
&lt;LI&gt;&lt;FONT size=3&gt;Scott Hanselman: &lt;/FONT&gt;&lt;A href="http://www.hanselman.com/blog/ASPNET35ExtensionsPlusMVCHowToScreencast.aspx" mce_href="http://www.hanselman.com/blog/ASPNET35ExtensionsPlusMVCHowToScreencast.aspx"&gt;&lt;FONT size=3&gt;Scott Hanselman's ASP.NET MVC First Look Screencast&lt;/FONT&gt;&lt;/A&gt; &lt;/LI&gt;
&lt;LI&gt;&lt;FONT size=3&gt;Phil Haack: &lt;/FONT&gt;&lt;A href="http://haacked.com/archive/2007/12/07/tdd-and-dependency-injection-with-asp.net-mvc.aspx" mce_href="http://haacked.com/archive/2007/12/07/tdd-and-dependency-injection-with-asp.net-mvc.aspx"&gt;&lt;FONT size=3&gt;TDD and Dependency Injection with the ASP.NET MVC Framework&lt;/FONT&gt;&lt;/A&gt; &lt;/LI&gt;
&lt;LI&gt;&lt;FONT size=3&gt;Phil Haack: &lt;/FONT&gt;&lt;A href="http://haacked.com/archive/2007/12/09/writing-unit-tests-for-controller-actions.aspx" mce_href="http://haacked.com/archive/2007/12/09/writing-unit-tests-for-controller-actions.aspx"&gt;&lt;FONT size=3&gt;Writing Unit Tests for Controller Actions&lt;/FONT&gt;&lt;/A&gt; &lt;/LI&gt;
&lt;LI&gt;&lt;FONT size=3&gt;Nikhil Kothari: &lt;/FONT&gt;&lt;A href="http://www.nikhilk.net/Ajax-MVC.aspx" mce_href="http://www.nikhilk.net/Ajax-MVC.aspx"&gt;&lt;FONT size=3&gt;Ajax with the ASP.NET MVC Framework&lt;/FONT&gt;&lt;/A&gt; &lt;/LI&gt;
&lt;LI&gt;&lt;FONT size=3&gt;Brad Abrams: &lt;/FONT&gt;&lt;A href="http://blogs.msdn.com/brada/archive/2007/11/14/rss-feed-with-the-new-asp-net-mvc-framework.aspx" mce_href="http://blogs.msdn.com/brada/archive/2007/11/14/rss-feed-with-the-new-asp-net-mvc-framework.aspx"&gt;&lt;FONT size=3&gt;RSS Feed with the new ASP.NET MVC Framework&lt;/FONT&gt;&lt;/A&gt; &lt;/LI&gt;&lt;/UL&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=5434791" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/leftslipper/archive/tags/ASP.NET/default.aspx">ASP.NET</category><category domain="http://weblogs.asp.net/leftslipper/archive/tags/unit+test/default.aspx">unit test</category><category domain="http://weblogs.asp.net/leftslipper/archive/tags/MVC/default.aspx">MVC</category><category domain="http://weblogs.asp.net/leftslipper/archive/tags/aspnetmvc/default.aspx">aspnetmvc</category></item><item><title>How to Allow Generic Controls in ASP.NET Pages</title><link>http://weblogs.asp.net/leftslipper/archive/2007/12/04/how-to-allow-generic-controls-in-asp-net-pages.aspx</link><pubDate>Tue, 04 Dec 2007 22:00:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:5402123</guid><dc:creator>Eilon</dc:creator><slash:comments>18</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/leftslipper/rsscomments.aspx?PostID=5402123</wfw:commentRss><comments>http://weblogs.asp.net/leftslipper/archive/2007/12/04/how-to-allow-generic-controls-in-asp-net-pages.aspx#comments</comments><description>&lt;P&gt;Did you ever want to have a Repeater&amp;lt;Customer&amp;gt; control on your page? And its events were all strongly typed to recognize that each row was bound to a Customer object? Well, I came up with a way of doing it using some lesser known features of ASP.NET.&lt;/P&gt;
&lt;P&gt;Today it's possible to use generic controls in ASP.NET, but you can't directly have a generic control in the tag markup. You'd typically have to do some trick such as deriving a concrete type from the generic type or instantiating the control from code-behind and adding it to a placeholder on the page.&lt;/P&gt;
&lt;P&gt;My solution involves using a &lt;A href="http://msdn2.microsoft.com/en-us/library/system.web.ui.controlbuilder.aspx" mce_href="http://msdn2.microsoft.com/en-us/library/system.web.ui.controlbuilder.aspx"&gt;ControlBuilder&lt;/A&gt; to alter how the ASP.NET tag gets parsed. Typically ASP.NET parses a tag such as &amp;lt;cc:GenericControl runat="server" /&amp;gt; and instantiated a type called GenericControl in the mapped "cc" namespace. My ControlBuilder overrides that behavior by returning an instance of GenericControl&amp;lt;TDataItem&amp;gt; whenever that tag is encountered.&lt;/P&gt;
&lt;P&gt;Here's an outline of my sample control:&lt;/P&gt;&lt;PRE class=code&gt;&lt;SPAN style="COLOR: blue"&gt;namespace &lt;/SPAN&gt;GenericControls {
    &lt;SPAN style="COLOR: blue"&gt;public class &lt;/SPAN&gt;&lt;SPAN style="COLOR: #2b91af"&gt;GenericControl&lt;/SPAN&gt;&amp;lt;TDataItem&amp;gt; : Control &lt;SPAN style="COLOR: blue"&gt;where &lt;/SPAN&gt;TDataItem : &lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt;() {
        &lt;SPAN style="COLOR: blue"&gt;public event &lt;/SPAN&gt;EventHandler&amp;lt;&lt;SPAN style="COLOR: #2b91af"&gt;GenericEventArgs&lt;/SPAN&gt;&amp;lt;TDataItem&amp;gt;&amp;gt; Stuffing {
            &lt;SPAN style="COLOR: blue"&gt;add&lt;/SPAN&gt;;
            &lt;SPAN style="COLOR: blue"&gt;remove&lt;/SPAN&gt;;
        }
    }
}&lt;/PRE&gt;&lt;A href="http://11011.net/software/vspaste" mce_href="http://11011.net/software/vspaste"&gt;&lt;/A&gt;
&lt;P&gt;Note that the control itself is generic over TDataItem, and that is exposes an event called "Stuffing" that uses a generic EventHandler with generic EventArgs also bound to TDataItem. So, if you have an instance of the GenericControl&amp;lt;Customer&amp;gt;, the event handler should take event arguments of type EventArgs&amp;lt;Customer&amp;gt;. Now you don't have to cast your event arguments to get to your data object!&lt;/P&gt;
&lt;P&gt;To use the control you specify the generic argument in the form of a pseudo-property on the control tag itself called ObjectType:&lt;/P&gt;&lt;PRE class=code&gt;        &lt;SPAN style="COLOR: blue"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;gc&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;:&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;GenericControlGeneric &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;runat&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="server" &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;ID&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="CustomerGeneric"
            &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;ObjectType&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="MyStuff.Customer, App_Code"
            &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;OnStuffing&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="CustomerGeneric_Stuffing"&amp;gt;
        &amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;gc&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;:&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;GenericControlGeneric&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;gt;
&lt;/SPAN&gt;&lt;/PRE&gt;&lt;A href="http://11011.net/software/vspaste" mce_href="http://11011.net/software/vspaste"&gt;&lt;/A&gt;
&lt;P&gt;Yes, my naming convention is horrible. Unless you thing GenericControlGeneric sounds good. But it doesn't sound good; it's horrible! :)&lt;/P&gt;
&lt;P&gt;And before anyone asks, the topic of generic syntax in tags has been &lt;A href="http://blogs.msdn.com/mikhailarkhipov/archive/2004/08/18/216957.aspx" mce_href="http://blogs.msdn.com/mikhailarkhipov/archive/2004/08/18/216957.aspx"&gt;discussed at length&lt;/A&gt;, so I won't repeat that here.&lt;/P&gt;
&lt;P&gt;In summary, I encourage you to check it out and see if it helps solve any problems you've had, hopefully without creating any new problems. This was just a pet project I did to see whether it was possible to create generic controls in markup.&lt;/P&gt;
&lt;P&gt;And finally, a caveat:&lt;/P&gt;
&lt;P&gt;While this seems to work great at runtime, I've encountered some weird problems in Visual Studio to support this. For example, when you try to add an event handler for the Stuffing event through the property grid you might get some weird behavior.&lt;/P&gt;
&lt;P&gt;Download the project source code here: &lt;A class="" href="http://weblogs.asp.net/leftslipper/attachment/5402123.ashx" mce_href="http://weblogs.asp.net/leftslipper/attachment/5402123.ashx"&gt;GenericControl.zip&lt;/A&gt;&lt;/P&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=5402123" width="1" height="1"&gt;</description><enclosure url="http://weblogs.asp.net/leftslipper/attachment/5402123.ashx" length="13265" type="application/x-zip-compressed" /><category domain="http://weblogs.asp.net/leftslipper/archive/tags/ASP.NET/default.aspx">ASP.NET</category><category domain="http://weblogs.asp.net/leftslipper/archive/tags/compilation/default.aspx">compilation</category><category domain="http://weblogs.asp.net/leftslipper/archive/tags/c_2300_/default.aspx">c#</category></item><item><title>DevConnections/ASPConnections Slides and Code</title><link>http://weblogs.asp.net/leftslipper/archive/2007/11/20/devconnections-aspconnections-slides-and-code.aspx</link><pubDate>Tue, 20 Nov 2007 19:00:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:5297777</guid><dc:creator>Eilon</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/leftslipper/rsscomments.aspx?PostID=5297777</wfw:commentRss><comments>http://weblogs.asp.net/leftslipper/archive/2007/11/20/devconnections-aspconnections-slides-and-code.aspx#comments</comments><description>&lt;P&gt;As a follow up to my &lt;A href="http://weblogs.asp.net/leftslipper/archive/2007/10/27/devconnections-aspconnections-2007-in-vegas.aspx" mce_href="http://weblogs.asp.net/leftslipper/archive/2007/10/27/devconnections-aspconnections-2007-in-vegas.aspx"&gt;previous post&lt;/A&gt;, here are links to Scott Hanselman's posts:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Slides: &lt;A class="" title=http://www.hanselman.com/blog/DevConnectionsTheASPNETMVCFramework.aspx href="http://www.hanselman.com/blog/DevConnectionsTheASPNETMVCFramework.aspx" mce_href="http://www.hanselman.com/blog/DevConnectionsTheASPNETMVCFramework.aspx"&gt;http://www.hanselman.com/blog/DevConnectionsTheASPNETMVCFramework.aspx&lt;/A&gt;&lt;/LI&gt;
&lt;LI&gt;Demo code: &lt;A title=http://www.hanselman.com/blog/DevConnectionsAndPNPSummitMVCDemosSourceCode.aspx href="http://www.hanselman.com/blog/DevConnectionsAndPNPSummitMVCDemosSourceCode.aspx" mce_href="http://www.hanselman.com/blog/DevConnectionsAndPNPSummitMVCDemosSourceCode.aspx"&gt;http://www.hanselman.com/blog/DevConnectionsAndPNPSummitMVCDemosSourceCode.aspx&lt;/A&gt;&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;As Scott notes, you won't be able to run the demo code and you won't be able to compile it either since the ASP.NET MVC framework is not yet available.&lt;/P&gt;
&lt;P&gt;I'd like to thank everyone who came to our talks and also those of you who stopped by afterwards to chat with us! And also those few of you who stopped by for photo opportunities :)&lt;/P&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=5297777" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/leftslipper/archive/tags/ASP.NET/default.aspx">ASP.NET</category><category domain="http://weblogs.asp.net/leftslipper/archive/tags/Speaking/default.aspx">Speaking</category></item><item><title>DevConnections/ASPConnections 2007 in Vegas</title><link>http://weblogs.asp.net/leftslipper/archive/2007/10/27/devconnections-aspconnections-2007-in-vegas.aspx</link><pubDate>Sat, 27 Oct 2007 22:00:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:4787888</guid><dc:creator>Eilon</dc:creator><slash:comments>7</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/leftslipper/rsscomments.aspx?PostID=4787888</wfw:commentRss><comments>http://weblogs.asp.net/leftslipper/archive/2007/10/27/devconnections-aspconnections-2007-in-vegas.aspx#comments</comments><description>&lt;P&gt;Next month I'll be co-speaking with &lt;A href="http://www.hanselman.com/blog/" mce_href="http://www.hanselman.com/blog/"&gt;Scott Hanselman&lt;/A&gt; at &lt;A href="http://www.devconnections.com/shows/FALL2007ASP/default.asp?s=101" mce_href="http://www.devconnections.com/shows/FALL2007ASP/default.asp?s=101"&gt;Microsoft ASP.NET Connections&lt;/A&gt; in Las Vegas. Completely stealing from ScottHa's post, this is the schedule for Tuesday, November 6:&lt;/P&gt;
&lt;P&gt;(Highlighted talks are the ones Scott and I are doing.)&lt;/P&gt;
&lt;TABLE class="" cellSpacing=0 cellPadding=2 width=400 border=1&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD class="" vAlign=top width=131&gt;Time&lt;/TD&gt;
&lt;TD class="" vAlign=top width=133&gt;Room 1&lt;/TD&gt;
&lt;TD class="" vAlign=top width=134&gt;Room 2&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="" vAlign=top width=131&gt;10:30 - 11:30&lt;/TD&gt;
&lt;TD class="" vAlign=top width=133&gt;AMS307: Building a Real World Web Application with Visual Studio 2008 and the .NET Framework v3.5, Part I of 3 &lt;/TD&gt;
&lt;TD class="" style="BACKGROUND-COLOR: yellow" vAlign=top width=134&gt;AMS302: Silverlight for ASP.NET Developers&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="" vAlign=top width=131&gt;11:45 - 12:45&lt;/TD&gt;
&lt;TD class="" vAlign=top width=133&gt;AMS308: Building a Real World Web Application with Visual Studio 2008 and the .NET Framework v3.5, Part 2 of 3&lt;/TD&gt;
&lt;TD class="" vAlign=top width=134&gt;AMS306: Developing Data Driven Applications Using ASP.NET Dynamic Data&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="" vAlign=top width=131&gt;2:30 - 3:30&lt;/TD&gt;
&lt;TD class="" vAlign=top width=133&gt;AMS303: Internet Information Services 7 for ASP.NET Developers&lt;/TD&gt;
&lt;TD class="" style="BACKGROUND-COLOR: yellow" vAlign=top width=134&gt;AMS304: Introduction to the new ASP.NET Model View Controller (MVC) Framework&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="" vAlign=top width=131&gt;4:14 - 5:15&lt;/TD&gt;
&lt;TD class="" style="BACKGROUND-COLOR: yellow" vAlign=top width=133&gt;AMS301: Building a Real World Web Application with Visual Studio 2008 and the .NET Framework v3.5, Part 3 of 3&lt;/TD&gt;
&lt;TD class="" vAlign=top width=135&gt;AMS305: Displaying Data with the new ListView and DataPager Controls in the .NET Framework 3.5&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;
&lt;P&gt;I hope to see you in Vegas, though I'll only be there a couple of days. If you see me feel free to ask me any questions about &lt;A href="http://weblogs.asp.net/scottgu/archive/2007/10/14/asp-net-mvc-framework.aspx" mce_href="http://weblogs.asp.net/scottgu/archive/2007/10/14/asp-net-mvc-framework.aspx"&gt;MVC in ASP.NET&lt;/A&gt;!&lt;/P&gt;
&lt;P&gt;(I really think the 4:14 start time is a mistake. But it does look nice next to the 5:15 end time!)&lt;/P&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=4787888" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/leftslipper/archive/tags/ASP.NET/default.aspx">ASP.NET</category><category domain="http://weblogs.asp.net/leftslipper/archive/tags/Speaking/default.aspx">Speaking</category></item><item><title>Using C# 3.0 Anonymous Types as Dictionaries</title><link>http://weblogs.asp.net/leftslipper/archive/2007/09/24/using-c-3-0-anonymous-types-as-dictionaries.aspx</link><pubDate>Mon, 24 Sep 2007 21:00:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:4119318</guid><dc:creator>Eilon</dc:creator><slash:comments>54</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/leftslipper/rsscomments.aspx?PostID=4119318</wfw:commentRss><comments>http://weblogs.asp.net/leftslipper/archive/2007/09/24/using-c-3-0-anonymous-types-as-dictionaries.aspx#comments</comments><description>During a design meeting for a new feature in ASP.NET we had a requirement that a new method accept a dictionary of name/values pairs. An obvious solution is to have the method accept a parameter of type IDictionary (or its generic cousin): public static...(&lt;a href="http://weblogs.asp.net/leftslipper/archive/2007/09/24/using-c-3-0-anonymous-types-as-dictionaries.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=4119318" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/leftslipper/archive/tags/c_2300_/default.aspx">c#</category></item><item><title>ScriptManager's EnablePartialRendering and SupportsPartialRendering properties</title><link>http://weblogs.asp.net/leftslipper/archive/2007/09/12/scriptmanager-s-enablepartialrendering-and-supportspartialrendering-properties.aspx</link><pubDate>Wed, 12 Sep 2007 22:00:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:3840143</guid><dc:creator>Eilon</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/leftslipper/rsscomments.aspx?PostID=3840143</wfw:commentRss><comments>http://weblogs.asp.net/leftslipper/archive/2007/09/12/scriptmanager-s-enablepartialrendering-and-supportspartialrendering-properties.aspx#comments</comments><description>In ASP.NET AJAX's ScriptManager control there are two properties that seem quite similar, but are in fact very different: namespace System.Web.UI { public class ScriptManager : Control { public bool EnablePartialRendering { get ; set ; } public bool SupportsPartialRendering...(&lt;a href="http://weblogs.asp.net/leftslipper/archive/2007/09/12/scriptmanager-s-enablepartialrendering-and-supportspartialrendering-properties.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=3840143" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/leftslipper/archive/tags/Atlas/default.aspx">Atlas</category><category domain="http://weblogs.asp.net/leftslipper/archive/tags/ASP.NET/default.aspx">ASP.NET</category><category domain="http://weblogs.asp.net/leftslipper/archive/tags/AJAX/default.aspx">AJAX</category><category domain="http://weblogs.asp.net/leftslipper/archive/tags/UpdatePanel/default.aspx">UpdatePanel</category></item><item><title>How ASP.NET databinding deals with Eval() and Bind() statements</title><link>http://weblogs.asp.net/leftslipper/archive/2007/06/29/how-asp-net-databinding-deals-with-eval-and-bind-statements.aspx</link><pubDate>Fri, 29 Jun 2007 22:00:11 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:2978834</guid><dc:creator>Eilon</dc:creator><slash:comments>17</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/leftslipper/rsscomments.aspx?PostID=2978834</wfw:commentRss><comments>http://weblogs.asp.net/leftslipper/archive/2007/06/29/how-asp-net-databinding-deals-with-eval-and-bind-statements.aspx#comments</comments><description>A recent question on one of our internal mailing lists asked where the definition for the Bind() method is located in ASP.NET. The asker had located the definition of the Eval() method on the TemplateControl class, but the Bind() method was nowhere to...(&lt;a href="http://weblogs.asp.net/leftslipper/archive/2007/06/29/how-asp-net-databinding-deals-with-eval-and-bind-statements.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=2978834" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/leftslipper/archive/tags/ASP.NET/default.aspx">ASP.NET</category><category domain="http://weblogs.asp.net/leftslipper/archive/tags/expressions/default.aspx">expressions</category><category domain="http://weblogs.asp.net/leftslipper/archive/tags/compilation/default.aspx">compilation</category></item><item><title>Changing the request culture for globalization and localization</title><link>http://weblogs.asp.net/leftslipper/archive/2007/06/19/changing-the-request-culture-for-globalization-and-localization.aspx</link><pubDate>Wed, 20 Jun 2007 03:00:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:2870244</guid><dc:creator>Eilon</dc:creator><slash:comments>4</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/leftslipper/rsscomments.aspx?PostID=2870244</wfw:commentRss><comments>http://weblogs.asp.net/leftslipper/archive/2007/06/19/changing-the-request-culture-for-globalization-and-localization.aspx#comments</comments><description>In ASP.NET 2.0 we added several new features to make globalizing and localizing an application easier than ever before. One of the coolest features is the ability to declaratively localize entire controls as well as individual properties of controls....(&lt;a href="http://weblogs.asp.net/leftslipper/archive/2007/06/19/changing-the-request-culture-for-globalization-and-localization.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=2870244" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/leftslipper/archive/tags/ASP.NET/default.aspx">ASP.NET</category><category domain="http://weblogs.asp.net/leftslipper/archive/tags/compilation/default.aspx">compilation</category><category domain="http://weblogs.asp.net/leftslipper/archive/tags/c_2300_/default.aspx">c#</category><category domain="http://weblogs.asp.net/leftslipper/archive/tags/localization/default.aspx">localization</category></item><item><title>Testing your ASP.NET control (part 1 of hopefully many): ViewState</title><link>http://weblogs.asp.net/leftslipper/archive/2007/05/31/testing-your-asp-net-control-part-1.aspx</link><pubDate>Thu, 31 May 2007 18:00:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:2699017</guid><dc:creator>Eilon</dc:creator><slash:comments>3</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/leftslipper/rsscomments.aspx?PostID=2699017</wfw:commentRss><comments>http://weblogs.asp.net/leftslipper/archive/2007/05/31/testing-your-asp-net-control-part-1.aspx#comments</comments><description>A typical ASP.NET server control will store at least some of its properties in ViewState. For example, the Label control saves the value of its Text property in ViewState so that on following postbacks the value does not need to be explicitly set again...(&lt;a href="http://weblogs.asp.net/leftslipper/archive/2007/05/31/testing-your-asp-net-control-part-1.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=2699017" width="1" height="1"&gt;</description><enclosure url="http://weblogs.asp.net/leftslipper/attachment/2699017.ashx" length="9249" type="application/x-zip-compressed" /><category domain="http://weblogs.asp.net/leftslipper/archive/tags/ASP.NET/default.aspx">ASP.NET</category><category domain="http://weblogs.asp.net/leftslipper/archive/tags/c_2300_/default.aspx">c#</category><category domain="http://weblogs.asp.net/leftslipper/archive/tags/unit+test/default.aspx">unit test</category></item><item><title>Using ObjectDataSource to do the dirty work for your custom data source</title><link>http://weblogs.asp.net/leftslipper/archive/2007/04/26/using-objectdatasource-to-do-the-dirty-work-for-your-custom-data-source.aspx</link><pubDate>Thu, 26 Apr 2007 18:00:59 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:2389533</guid><dc:creator>Eilon</dc:creator><slash:comments>12</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/leftslipper/rsscomments.aspx?PostID=2389533</wfw:commentRss><comments>http://weblogs.asp.net/leftslipper/archive/2007/04/26/using-objectdatasource-to-do-the-dirty-work-for-your-custom-data-source.aspx#comments</comments><description>Since ASP.NET 2.0 was released in 2005 many of you have taken advantage of the new data source control controls . Drop a GridView on the page. Bind it to a data source. Check a few checkboxes. Run the page. Go home early! However, some of you want to...(&lt;a href="http://weblogs.asp.net/leftslipper/archive/2007/04/26/using-objectdatasource-to-do-the-dirty-work-for-your-custom-data-source.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=2389533" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/leftslipper/archive/tags/ASP.NET/default.aspx">ASP.NET</category><category domain="http://weblogs.asp.net/leftslipper/archive/tags/c_2300_/default.aspx">c#</category><category domain="http://weblogs.asp.net/leftslipper/archive/tags/objectdatasource/default.aspx">objectdatasource</category></item></channel></rss>