<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:copyright="http://blogs.law.harvard.edu/tech/rss" xmlns:image="http://purl.org/rss/1.0/modules/image/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">
    <channel>
        <title>Sean Lynch</title>
        <link>http://whatstirs.com/blog/Default.aspx</link>
        <description />
        <language>en-US</language>
        <copyright>Sean Lynch</copyright>
        <generator>Subtext Version 2.1.1.1</generator>
        <image>
            <title>Sean Lynch</title>
            <url>http://whatstirs.com/blog/images/RSS2Image.gif</url>
            <link>http://whatstirs.com/blog/Default.aspx</link>
            <width>77</width>
            <height>60</height>
        </image>
        <atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.com/MyHeadsExploding" type="application/rss+xml" /><item>
            <title>ScriptControl question</title>
            <category>.Net</category>
            <category>Development</category>
            <category>Work</category>
            <link>http://feedproxy.google.com/~r/MyHeadsExploding/~3/VhdLp0B_cI4/scriptcontrol-question.aspx</link>
            <description>&lt;p&gt;As of late I have gotten a chance to use the ASP.Net AJAX extenders and script controls, and so far am really liking how they work, though it would be nice if adding the .js was a little cleaner then manually adding them to the assembly wether in the AssemblyInfo.cs or the controls cs file.&lt;/p&gt;  &lt;p&gt;I have to say I really like the extender and script controls that come with the ASP.NET AJAX. They really are so much nicer to work with then building up Javascript strings in the CS file of the server control. &lt;/p&gt;  &lt;p&gt;I do have a question about them though. One of the ScriptControls I made uses a webservice to pull data if the service name is set. At the moment I have it dynamically registering an JSON script service based webservice. Unfortunately I have found that this is not an optimal solution since the name of the Javascript object created by the ScriptService changes depending on the namespace and class name of the service. &lt;/p&gt;  &lt;p&gt;I am sure that there is a better way to do this, but I am not exactly certain of it. Any suggestions or links would be appreciated.&lt;/p&gt;&lt;img src="http://whatstirs.com/blog/aggbug/58.aspx" width="1" height="1" /&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/MyHeadsExploding?a=VhdLp0B_cI4:X_Ca5R51G78:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyHeadsExploding?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/MyHeadsExploding?a=VhdLp0B_cI4:X_Ca5R51G78:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyHeadsExploding?i=VhdLp0B_cI4:X_Ca5R51G78:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/MyHeadsExploding?a=VhdLp0B_cI4:X_Ca5R51G78:dnMXMwOfBR0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyHeadsExploding?d=dnMXMwOfBR0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/MyHeadsExploding?a=VhdLp0B_cI4:X_Ca5R51G78:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyHeadsExploding?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/MyHeadsExploding/~4/VhdLp0B_cI4" height="1" width="1"/&gt;</description>
            <dc:creator>Sean Lynch</dc:creator>
            <guid isPermaLink="false">http://whatstirs.com/blog/archive/2008/07/07/scriptcontrol-question.aspx</guid>
            <pubDate>Tue, 08 Jul 2008 08:09:08 GMT</pubDate>
            <wfw:comment>http://whatstirs.com/blog/comments/58.aspx</wfw:comment>
            <comments>http://whatstirs.com/blog/archive/2008/07/07/scriptcontrol-question.aspx#feedback</comments>
            <wfw:commentRss>http://whatstirs.com/blog/comments/commentRss/58.aspx</wfw:commentRss>
        <feedburner:origLink>http://whatstirs.com/blog/archive/2008/07/07/scriptcontrol-question.aspx</feedburner:origLink></item>
        <item>
            <title>Lazy list</title>
            <category>.Net</category>
            <category>Development</category>
            <category>MS Mvc</category>
            <link>http://feedproxy.google.com/~r/MyHeadsExploding/~3/WGBNQ3OhbJs/lazy-list.aspx</link>
            <description>&lt;p&gt;I have been following &lt;a href="http://blog.wekeroad.com/" target="_blank"&gt;Rob Conery's&lt;/a&gt; posts on the MVC Storefront, and trying the repository/pipes-filters for data access that he has been using.&lt;/p&gt; &lt;p&gt;While trying out the implementation of a LazyList he was using, I had noticed that the example table was being joined onto the category table. At the time however, I really had not thought much of it, until I read &lt;a href="http://blog.wekeroad.com/mvc-storefront/mvcstore-intermission2/" target="_blank"&gt;MVC Storefront: Brainbender Intermission&lt;/a&gt; which got me thinking. &lt;/p&gt; &lt;p&gt;Admittedly, I don't really have to much of a problem with it loading all of the examples for all the categories at one time at the moment. However, I figured it would be nice to have it work the way intended, and query the database for the examples in a category only when asked for.&lt;/p&gt; &lt;p&gt;I liked the idea of the LazyList, and since I was already using a Service class for all data access, along with setting up the category hierarchy I moved the creation of the LazyList of examples property into the the GetCategories method of the service class.&lt;/p&gt; &lt;p&gt;It seems that as long as the LazyList is created after the categories .ToList() call it properly works. So I ended up with this code:&lt;/p&gt;&lt;pre class="code"&gt;            categories.ForEach(category =&amp;gt;
            {
                category.Examples =
                    &lt;span style="color: rgb(0,0,255)"&gt;new&lt;/span&gt; &lt;span style="color: rgb(43,145,175)"&gt;LazyList
&lt;/span&gt;                        &amp;lt;DevExamples.Data.&lt;span style="color: rgb(43,145,175)"&gt;Example&lt;/span&gt;&amp;gt;(
                        &lt;span style="color: rgb(0,0,255)"&gt;from&lt;/span&gt; e &lt;span style="color: rgb(0,0,255)"&gt;in&lt;/span&gt; repository.GetExamples()
                        &lt;span style="color: rgb(0,0,255)"&gt;where&lt;/span&gt; e.CategoryId == category.ID
                        &lt;span style="color: rgb(0,0,255)"&gt;select&lt;/span&gt; e);

                &lt;span style="color: rgb(0,0,255)"&gt;var&lt;/span&gt; subCategories = (&lt;span style="color: rgb(0,0,255)"&gt;from&lt;/span&gt; sub &lt;span style="color: rgb(0,0,255)"&gt;in&lt;/span&gt; categories
                                     &lt;span style="color: rgb(0,0,255)"&gt;where&lt;/span&gt; sub.ParentId == category.ID
                                     &lt;span style="color: rgb(0,0,255)"&gt;select&lt;/span&gt; sub).ToList();
                category.SubCategories = subCategories;

                subCategories.ForEach(c =&amp;gt; c.Parent = category);

            });
&lt;/pre&gt;
&lt;p&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt; &lt;/p&gt;
&lt;div class="wlWriterSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:b2911609-4a75-4f29-a40f-6f2131b013b6" style="padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;Technorati Tags: &lt;a href="http://technorati.com/tags/aspnetmvc" rel="tag"&gt;aspnetmvc&lt;/a&gt;&lt;/div&gt;&lt;img src="http://whatstirs.com/blog/aggbug/57.aspx" width="1" height="1" /&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/MyHeadsExploding?a=WGBNQ3OhbJs:TvP6ldw5obI:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyHeadsExploding?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/MyHeadsExploding?a=WGBNQ3OhbJs:TvP6ldw5obI:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyHeadsExploding?i=WGBNQ3OhbJs:TvP6ldw5obI:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/MyHeadsExploding?a=WGBNQ3OhbJs:TvP6ldw5obI:dnMXMwOfBR0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyHeadsExploding?d=dnMXMwOfBR0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/MyHeadsExploding?a=WGBNQ3OhbJs:TvP6ldw5obI:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyHeadsExploding?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/MyHeadsExploding/~4/WGBNQ3OhbJs" height="1" width="1"/&gt;</description>
            <dc:creator>Sean Lynch</dc:creator>
            <guid isPermaLink="false">http://whatstirs.com/blog/archive/2008/05/21/lazy-list.aspx</guid>
            <pubDate>Wed, 21 May 2008 16:34:18 GMT</pubDate>
            <wfw:comment>http://whatstirs.com/blog/comments/57.aspx</wfw:comment>
            <comments>http://whatstirs.com/blog/archive/2008/05/21/lazy-list.aspx#feedback</comments>
            <wfw:commentRss>http://whatstirs.com/blog/comments/commentRss/57.aspx</wfw:commentRss>
        <feedburner:origLink>http://whatstirs.com/blog/archive/2008/05/21/lazy-list.aspx</feedburner:origLink></item>
        <item>
            <title>Custom Rss Admin feeds</title>
            <category>Subtext</category>
            <link>http://feedproxy.google.com/~r/MyHeadsExploding/~3/JBJR1PC4nNY/custom-rss-admin-feeds.aspx</link>
            <description>&lt;p&gt;I fixed up the Rss Admin feeds so that modifying web.config (along with new handler classes) would not needed to add a new Admin Rss feed.&lt;/p&gt;
&lt;p&gt;Also added a simple form to allow administrators to created their own. It is a bit limited, but adding additional options should not be to hard. Though those will have to wait till a later date.&lt;/p&gt;
&lt;p&gt;On a side note, I found that if I had the option of returning the non-generic  base class, or a generic subclass it makes the code a lot more flexible if you return the non-generic base class if you do not have a need to have the generic type.&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;div class="wlWriterSmartContent" id="0767317B-992E-4b12-91E0-4F059A8CECA8:c06d95d5-7421-4ef4-a901-c66d789e2806" contenteditable="false" style="PADDING-RIGHT: 0px; DISPLAY: inline; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-TOP: 0px"&gt;Technorati Tags: &lt;a rel="tag" href="http://technorati.com/tags/Subtext"&gt;Subtext&lt;/a&gt;&lt;/div&gt;&lt;img src="http://whatstirs.com/blog/aggbug/36.aspx" width="1" height="1" /&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/MyHeadsExploding?a=JBJR1PC4nNY:21eBXRm1Oi4:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyHeadsExploding?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/MyHeadsExploding?a=JBJR1PC4nNY:21eBXRm1Oi4:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyHeadsExploding?i=JBJR1PC4nNY:21eBXRm1Oi4:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/MyHeadsExploding?a=JBJR1PC4nNY:21eBXRm1Oi4:dnMXMwOfBR0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyHeadsExploding?d=dnMXMwOfBR0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/MyHeadsExploding?a=JBJR1PC4nNY:21eBXRm1Oi4:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyHeadsExploding?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/MyHeadsExploding/~4/JBJR1PC4nNY" height="1" width="1"/&gt;</description>
            <dc:creator>Sean Lynch</dc:creator>
            <guid isPermaLink="false">http://whatstirs.com/blog/archive/2008/04/20/custom-rss-admin-feeds.aspx</guid>
            <pubDate>Mon, 21 Apr 2008 10:34:55 GMT</pubDate>
            <wfw:comment>http://whatstirs.com/blog/comments/36.aspx</wfw:comment>
            <comments>http://whatstirs.com/blog/archive/2008/04/20/custom-rss-admin-feeds.aspx#feedback</comments>
            <wfw:commentRss>http://whatstirs.com/blog/comments/commentRss/36.aspx</wfw:commentRss>
        <feedburner:origLink>http://whatstirs.com/blog/archive/2008/04/20/custom-rss-admin-feeds.aspx</feedburner:origLink></item>
        <item>
            <title>The joys of spam</title>
            <link>http://feedproxy.google.com/~r/MyHeadsExploding/~3/hhj5AMFKQSw/the-joys-of-spam.aspx</link>
            <description>&lt;p&gt;I woke up this morning to 600+ bounce messages in my inbox. And over the course of the day probably another 600+.&lt;/p&gt;  &lt;p&gt;Apparently someone decided that it would be fun to send a spam message around 11:40 last night using my email address. &lt;/p&gt;  &lt;p&gt;Hopefully this was a one time thing. So I don't have to try to figure out where all I need to change this email address at.&lt;/p&gt;&lt;img src="http://whatstirs.com/blog/aggbug/56.aspx" width="1" height="1" /&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/MyHeadsExploding?a=hhj5AMFKQSw:j3SZ21PmdWo:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyHeadsExploding?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/MyHeadsExploding?a=hhj5AMFKQSw:j3SZ21PmdWo:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyHeadsExploding?i=hhj5AMFKQSw:j3SZ21PmdWo:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/MyHeadsExploding?a=hhj5AMFKQSw:j3SZ21PmdWo:dnMXMwOfBR0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyHeadsExploding?d=dnMXMwOfBR0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/MyHeadsExploding?a=hhj5AMFKQSw:j3SZ21PmdWo:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyHeadsExploding?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/MyHeadsExploding/~4/hhj5AMFKQSw" height="1" width="1"/&gt;</description>
            <dc:creator>Sean Lynch</dc:creator>
            <guid isPermaLink="false">http://whatstirs.com/blog/archive/2008/04/20/the-joys-of-spam.aspx</guid>
            <pubDate>Mon, 21 Apr 2008 09:11:02 GMT</pubDate>
            <wfw:comment>http://whatstirs.com/blog/comments/56.aspx</wfw:comment>
            <comments>http://whatstirs.com/blog/archive/2008/04/20/the-joys-of-spam.aspx#feedback</comments>
            <wfw:commentRss>http://whatstirs.com/blog/comments/commentRss/56.aspx</wfw:commentRss>
        <feedburner:origLink>http://whatstirs.com/blog/archive/2008/04/20/the-joys-of-spam.aspx</feedburner:origLink></item>
        <item>
            <title>.Net based SVN client library</title>
            <link>http://feedproxy.google.com/~r/MyHeadsExploding/~3/RmPvgLVqYQY/.net-based-svn-client-library.aspx</link>
            <description>&lt;p&gt;As an exercise to figure out socket programming I have been messing around with creating an SVN client library to use with DevExamples.com, well actually a generic SC client library that would allow me to change what repository site I was working against, SVN just seemed like the simplest of them at the moment.&lt;/p&gt; &lt;p&gt;However, after thinking about it, I think it would be better to use one that is already built if possible. I just have not been able to find a pure .Net client library. It is also seems rare for a source control library to work without a working folder, which is somewhat limiting when I want to check the propagation of examples using this method on the same machine.&lt;/p&gt; &lt;p&gt;Though I think it would be interesting to write a LINQ to Source provider, as a way to learn expression trees better. Plus it would be nice to be able to not only easily switch hosting providers (the reason I am looking for a pure .Net library) but also to have a standard syntax to allow me to easily switch from SVN to &lt;a href="http://sourcegear.com/vault/index.html"&gt;SourceGear's Vault&lt;/a&gt; (which I use for my personal development projects) to TFS (which we use at work) as the storage system for the examples.&lt;/p&gt; &lt;p&gt;Though &lt;a href="http://www.codeplex.com/SvnBridge"&gt;SvnBridge&lt;/a&gt; could possibly help with that too.&lt;/p&gt; &lt;div class="wlWriterSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:b1c1d208-8688-4361-be36-f0dbfa4721fb" style="padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;Technorati Tags: &lt;a href="http://technorati.com/tags/SVN" rel="tag"&gt;SVN&lt;/a&gt;,&lt;a href="http://technorati.com/tags/Vault" rel="tag"&gt;Vault&lt;/a&gt;,&lt;a href="http://technorati.com/tags/.Net" rel="tag"&gt;.Net&lt;/a&gt;,&lt;a href="http://technorati.com/tags/LINQ" rel="tag"&gt;LINQ&lt;/a&gt;&lt;/div&gt;&lt;img src="http://whatstirs.com/blog/aggbug/55.aspx" width="1" height="1" /&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/MyHeadsExploding?a=RmPvgLVqYQY:66yaaxBVOVc:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyHeadsExploding?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/MyHeadsExploding?a=RmPvgLVqYQY:66yaaxBVOVc:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyHeadsExploding?i=RmPvgLVqYQY:66yaaxBVOVc:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/MyHeadsExploding?a=RmPvgLVqYQY:66yaaxBVOVc:dnMXMwOfBR0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyHeadsExploding?d=dnMXMwOfBR0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/MyHeadsExploding?a=RmPvgLVqYQY:66yaaxBVOVc:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyHeadsExploding?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/MyHeadsExploding/~4/RmPvgLVqYQY" height="1" width="1"/&gt;</description>
            <dc:creator>Sean Lynch</dc:creator>
            <guid isPermaLink="false">http://whatstirs.com/blog/archive/2008/03/18/.net-based-svn-client-library.aspx</guid>
            <pubDate>Tue, 18 Mar 2008 16:30:38 GMT</pubDate>
            <wfw:comment>http://whatstirs.com/blog/comments/55.aspx</wfw:comment>
            <comments>http://whatstirs.com/blog/archive/2008/03/18/.net-based-svn-client-library.aspx#feedback</comments>
            <slash:comments>2</slash:comments>
            <wfw:commentRss>http://whatstirs.com/blog/comments/commentRss/55.aspx</wfw:commentRss>
        <feedburner:origLink>http://whatstirs.com/blog/archive/2008/03/18/.net-based-svn-client-library.aspx</feedburner:origLink></item>
        <item>
            <title>I feel so behind sometimes</title>
            <category>.Net</category>
            <category>Development</category>
            <category>Learning</category>
            <link>http://feedproxy.google.com/~r/MyHeadsExploding/~3/utMe_pQXFFI/i-feel-so-behind-sometimes.aspx</link>
            <description>&lt;p&gt;I was trying to determine the best way to secure my admin* actions when I thought of something I had only really seen while studying for my MCSD.Net exams, or maybe it was the MCPD upgrade exams I haven't gotten round to taking. &lt;/p&gt;
&lt;p&gt;I decided to secure the admin controller actions using.&lt;/p&gt;
&lt;pre class="code"&gt;[&lt;span style="COLOR: rgb(43,145,175)"&gt;PrincipalPermission&lt;/span&gt;(&lt;span style="COLOR: rgb(43,145,175)"&gt;SecurityAction&lt;/span&gt;.Demand,Role=&lt;span style="COLOR: rgb(163,21,21)"&gt;"&amp;lt;Role&amp;gt;"&lt;/span&gt;)] &lt;/pre&gt;
&lt;p&gt;Which I had never used even though I started programming .Net in during the beta of 1.0. And I have to admit that each time I run into something like this, it makes me feel that my thought in &lt;a href="http://myheadsexploding.com/archive/2007/12/11/i-think-the-3.5-framework-might-be-the-straw.aspx"&gt;a previous post&lt;/a&gt; is right.&lt;/p&gt;
&lt;p&gt;This works for my immediate needs, after thinking about it, it would be nice if the Route Validation could deal with security too. That way instead of getting "&lt;em&gt;Security Exception" &lt;/em&gt;when navigating to one of the admin actions, the route would simply not resolve resulting in "&lt;em&gt;An action named 'New could not be found on the controller." &lt;/em&gt;if someone was trying out the obvious Urls for maintenance, since they are rather hackable (from Phil Haack's recent interview on the &lt;a href="http://morewally.com/cs/blogs/wallym/archive/2007/12/14/asp-net-podcast-show-106-phil-haack-on-asp-net-mvc.aspx"&gt;ASP.Net Podcast show&lt;/a&gt; ).  &lt;/p&gt;
&lt;p&gt;Though now that I write that I think it would be better to have it throw the Security Exception, log it, then handle both errors be handle it as a 404 error from then on. That way I can log information of the unauthorized attempts on the admin actions, without telling the outside world anything. So maybe I don't need to be able to specify authentication validation on the routes after all. Though routes based on errors might be nice.&lt;/p&gt;
&lt;p&gt;Now I just need to look up more on custom error pages. &lt;/p&gt;
&lt;p&gt;I really do feel so behind sometimes.&lt;/p&gt;
&lt;p&gt;&lt;font size="1"&gt;* Will be making a post in next few days on this. The dynamic stuff I had started for the &lt;/font&gt;&lt;a href="http://myheadsexploding.com/archive/2007/12/16/generic-beginend-html-tag-extension-method.aspx"&gt;&lt;font size="1"&gt;last post&lt;/font&gt;&lt;/a&gt;&lt;font size="1"&gt; was a bit more usable in the admin area.&lt;/font&gt;&lt;/p&gt;
&lt;div class="wlWriterSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:97c69bff-98a0-4561-b71f-5f38f951c61f" style="PADDING-RIGHT: 0px; DISPLAY: inline; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-TOP: 0px"&gt;Technorati Tags: &lt;a rel="tag" href="http://technorati.com/tags/aspnetmvc"&gt;aspnetmvc&lt;/a&gt;, &lt;a rel="tag" href="http://technorati.com/tags/Security"&gt;Security&lt;/a&gt;&lt;/div&gt;&lt;img src="http://whatstirs.com/blog/aggbug/44.aspx" width="1" height="1" /&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/MyHeadsExploding?a=utMe_pQXFFI:lUaa9lTlO6Q:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyHeadsExploding?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/MyHeadsExploding?a=utMe_pQXFFI:lUaa9lTlO6Q:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyHeadsExploding?i=utMe_pQXFFI:lUaa9lTlO6Q:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/MyHeadsExploding?a=utMe_pQXFFI:lUaa9lTlO6Q:dnMXMwOfBR0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyHeadsExploding?d=dnMXMwOfBR0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/MyHeadsExploding?a=utMe_pQXFFI:lUaa9lTlO6Q:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyHeadsExploding?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/MyHeadsExploding/~4/utMe_pQXFFI" height="1" width="1"/&gt;</description>
            <dc:creator>Sean Lynch</dc:creator>
            <guid isPermaLink="false">http://whatstirs.com/blog/archive/2008/03/18/i-feel-so-behind-sometimes.aspx</guid>
            <pubDate>Tue, 18 Mar 2008 15:56:09 GMT</pubDate>
            <wfw:comment>http://whatstirs.com/blog/comments/44.aspx</wfw:comment>
            <comments>http://whatstirs.com/blog/archive/2008/03/18/i-feel-so-behind-sometimes.aspx#feedback</comments>
            <wfw:commentRss>http://whatstirs.com/blog/comments/commentRss/44.aspx</wfw:commentRss>
        <feedburner:origLink>http://whatstirs.com/blog/archive/2008/03/18/i-feel-so-behind-sometimes.aspx</feedburner:origLink></item>
        <item>
            <title>Temp service provider implementation</title>
            <category>.Net</category>
            <category>Development</category>
            <category>MS Mvc</category>
            <link>http://feedproxy.google.com/~r/MyHeadsExploding/~3/XraxPKMhXn8/temp-service-provider-implementation.aspx</link>
            <description>&lt;p&gt;Well, Bill Pierce in his post about making the &lt;a href="http://blechie.com/WPierce/archive/2007/12/16/On-the-Extensibility-of-ASP.Net-MVC.aspx"&gt;HttpContext wrapper use the application as a service provider&lt;/a&gt; got me to a good enough solution for the script service I had wanted in my &lt;a href="http://myheadsexploding.com/archive/2007/12/16/generic-beginend-html-tag-extension-method.aspx"&gt;previous post&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;While not quite as clean as adding it to the HttpContext, I think an extension method on HttpApplication like this will work well for now. &lt;/p&gt;
&lt;pre class="code"&gt;&lt;span style="COLOR: blue"&gt;public static object &lt;/span&gt;GetService(&lt;span style="COLOR: blue"&gt;this &lt;/span&gt;&lt;span style="COLOR: #2b91af"&gt;HttpApplication &lt;/span&gt;application,&lt;span style="COLOR: #2b91af"&gt;Type &lt;/span&gt;service)
{
    &lt;span style="COLOR: #2b91af"&gt;IServiceProvider &lt;/span&gt;provider = application &lt;span style="COLOR: blue"&gt;as &lt;/span&gt;&lt;span style="COLOR: #2b91af"&gt;IServiceProvider&lt;/span&gt;;
    &lt;span style="COLOR: blue"&gt;if &lt;/span&gt;(provider == &lt;span style="COLOR: blue"&gt;null&lt;/span&gt;)
        &lt;span style="COLOR: blue"&gt;return null&lt;/span&gt;;

    &lt;span style="COLOR: blue"&gt;return &lt;/span&gt;provider.GetService(service);
}
&lt;/pre&gt;
&lt;p&gt;Then add/implement the IServiceProvider on the Global class. Allowing me to get an instance of the script service using  &lt;/p&gt;
&lt;pre class="code"&gt;&lt;span style="COLOR: #2b91af"&gt;IScriptService &lt;/span&gt;scriptSvc &lt;br /&gt;    = &lt;span style="COLOR: blue"&gt;this&lt;/span&gt;.HttpContext.ApplicationInstance.GetService(&lt;span style="COLOR: blue"&gt;typeof&lt;/span&gt;(&lt;span style="COLOR: #2b91af"&gt;IScriptService&lt;/span&gt;))
    &lt;span style="COLOR: blue"&gt;as &lt;/span&gt;&lt;span style="COLOR: #2b91af"&gt;IScriptService&lt;/span&gt;;
&lt;/pre&gt;
&lt;p&gt;Though though the more I think of it, the more likely I am to stick this method on the Ajax and Html helper classes. I wonder how hard it would be to add an interface like IMvcHelper to both the AjaxHelper and HtmlHelper Classes my extension method would be available to both, without duplicating code. &lt;/p&gt;
&lt;div class="wlWriterSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:5b7d24d4-583f-43bb-bb38-8a159374e46f" style="PADDING-RIGHT: 0px; DISPLAY: inline; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-TOP: 0px"&gt;Technorati Tags: &lt;a rel="tag" href="http://technorati.com/tags/aspnetmvc"&gt;aspnetmvc&lt;/a&gt;,&lt;a rel="tag" href="http://technorati.com/tags/Service%20Provider"&gt;Service Provider&lt;/a&gt;,&lt;a rel="tag" href="http://technorati.com/tags/Extension%20Method"&gt;Extension Method&lt;/a&gt;&lt;/div&gt;&lt;img src="http://whatstirs.com/blog/aggbug/45.aspx" width="1" height="1" /&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/MyHeadsExploding?a=XraxPKMhXn8:eVj-nwjU4Uc:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyHeadsExploding?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/MyHeadsExploding?a=XraxPKMhXn8:eVj-nwjU4Uc:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyHeadsExploding?i=XraxPKMhXn8:eVj-nwjU4Uc:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/MyHeadsExploding?a=XraxPKMhXn8:eVj-nwjU4Uc:dnMXMwOfBR0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyHeadsExploding?d=dnMXMwOfBR0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/MyHeadsExploding?a=XraxPKMhXn8:eVj-nwjU4Uc:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyHeadsExploding?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/MyHeadsExploding/~4/XraxPKMhXn8" height="1" width="1"/&gt;</description>
            <dc:creator>Sean Lynch</dc:creator>
            <guid isPermaLink="false">http://whatstirs.com/blog/archive/2008/03/18/temp-service-provider-implementation.aspx</guid>
            <pubDate>Tue, 18 Mar 2008 15:55:46 GMT</pubDate>
            <wfw:comment>http://whatstirs.com/blog/comments/45.aspx</wfw:comment>
            <comments>http://whatstirs.com/blog/archive/2008/03/18/temp-service-provider-implementation.aspx#feedback</comments>
            <wfw:commentRss>http://whatstirs.com/blog/comments/commentRss/45.aspx</wfw:commentRss>
        <feedburner:origLink>http://whatstirs.com/blog/archive/2008/03/18/temp-service-provider-implementation.aspx</feedburner:origLink></item>
        <item>
            <title>Login via Usercontrol View + jQuery</title>
            <category>.Net</category>
            <category>Development</category>
            <category>Learning</category>
            <link>http://feedproxy.google.com/~r/MyHeadsExploding/~3/bjrhs3fwNls/login-via-usercontrol-view-jquery.aspx</link>
            <description>&lt;p&gt;Since administration was the next part I wanted to work on.&lt;/p&gt;
&lt;p&gt;I decided that for the moment I just want a little login for in the upper corner like&lt;/p&gt;
&lt;p&gt;&lt;a href="http://myheadsexploding.com/images/myheadsexploding_com/WindowsLiveWriter/LoginviaUsercontrolViewjQuery_14D0E/image_2.png"&gt;&lt;img style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" height="191" alt="image" width="232" border="0" src="http://myheadsexploding.com/images/myheadsexploding_com/WindowsLiveWriter/LoginviaUsercontrolViewjQuery_14D0E/image_thumb.png" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;I decided to put the login screen view logic into a user control, and added the following user control named Login.ascx and placed it into the Shared &lt;/p&gt;
&lt;pre class="code"&gt;&lt;span style="BACKGROUND: rgb(255,238,98)"&gt;&amp;lt;%&lt;span style="COLOR: rgb(0,0,255)" /&gt;@&lt;/span&gt; &lt;span style="COLOR: rgb(163,21,21)"&gt;Control&lt;/span&gt; &lt;span style="COLOR: rgb(255,0,0)"&gt;Language&lt;/span&gt;&lt;span style="COLOR: rgb(0,0,255)"&gt;="C#"&lt;/span&gt; &lt;span style="COLOR: rgb(255,0,0)"&gt;Inherits&lt;/span&gt;&lt;span style="COLOR: rgb(0,0,255)"&gt;="System.Web.Mvc.ViewUserControl"&lt;/span&gt; &lt;span style="BACKGROUND: rgb(255,238,98)"&gt;%&amp;gt;

&amp;lt;%&lt;span style="COLOR: rgb(0,0,255)" /&gt;if&lt;/span&gt;(!Page.User.Identity.IsAuthenticated) {&lt;span style="BACKGROUND: rgb(255,238,98)"&gt;%&amp;gt;
&lt;/span&gt;    &lt;span style="COLOR: rgb(0,0,255)"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: rgb(163,21,21)"&gt;form&lt;/span&gt; &lt;span style="COLOR: rgb(255,0,0)"&gt;action&lt;/span&gt;&lt;span style="COLOR: rgb(0,0,255)"&gt;="/Home/Login"&lt;/span&gt; &lt;span style="COLOR: rgb(255,0,0)"&gt;method&lt;/span&gt;&lt;span style="COLOR: rgb(0,0,255)"&gt;="post"&lt;/span&gt; &lt;span style="COLOR: rgb(255,0,0)"&gt;id&lt;/span&gt;&lt;span style="COLOR: rgb(0,0,255)"&gt;="LoginForm"&amp;gt;
&lt;/span&gt;        &lt;span style="COLOR: rgb(0,0,255)"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: rgb(163,21,21)"&gt;span&lt;/span&gt; &lt;span style="COLOR: rgb(255,0,0)"&gt;id&lt;/span&gt;&lt;span style="COLOR: rgb(0,0,255)"&gt;="EmailLabel"&amp;gt;&lt;/span&gt;Username:&lt;span style="COLOR: rgb(0,0,255)"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="COLOR: rgb(163,21,21)"&gt;span&lt;/span&gt;&lt;span style="COLOR: rgb(0,0,255)"&gt;&amp;gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: rgb(163,21,21)"&gt;br&lt;/span&gt; &lt;span style="COLOR: rgb(0,0,255)"&gt;/&amp;gt;
&lt;/span&gt;        &lt;span style="BACKGROUND: rgb(255,238,98)"&gt;&amp;lt;%&lt;span style="COLOR: rgb(0,0,255)" /&gt;=&lt;/span&gt;Html.TextBox(&lt;span style="COLOR: rgb(163,21,21)"&gt;"Username"&lt;/span&gt;)&lt;span style="BACKGROUND: rgb(255,238,98)"&gt;%&amp;gt;&lt;span style="COLOR: rgb(0,0,255)" /&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: rgb(163,21,21)"&gt;br&lt;/span&gt; &lt;span style="COLOR: rgb(0,0,255)"&gt;/&amp;gt;
&lt;/span&gt;        &lt;span style="COLOR: rgb(0,0,255)"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: rgb(163,21,21)"&gt;span&lt;/span&gt; &lt;span style="COLOR: rgb(255,0,0)"&gt;id&lt;/span&gt;&lt;span style="COLOR: rgb(0,0,255)"&gt;="PasswordLabel"&amp;gt;&lt;/span&gt;Password:&lt;span style="COLOR: rgb(0,0,255)"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="COLOR: rgb(163,21,21)"&gt;span&lt;/span&gt;&lt;span style="COLOR: rgb(0,0,255)"&gt;&amp;gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: rgb(163,21,21)"&gt;br&lt;/span&gt; &lt;span style="COLOR: rgb(0,0,255)"&gt;/&amp;gt;
&lt;/span&gt;        &lt;span style="BACKGROUND: rgb(255,238,98)"&gt;&amp;lt;%&lt;span style="COLOR: rgb(0,0,255)" /&gt;=&lt;/span&gt;Html.Password(&lt;span style="COLOR: rgb(163,21,21)"&gt;"Password"&lt;/span&gt;)&lt;span style="BACKGROUND: rgb(255,238,98)"&gt;%&amp;gt;&lt;span style="COLOR: rgb(0,0,255)" /&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: rgb(163,21,21)"&gt;br&lt;/span&gt; &lt;span style="COLOR: rgb(0,0,255)"&gt;/&amp;gt;
&lt;/span&gt;         &lt;span style="COLOR: rgb(0,0,255)"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: rgb(163,21,21)"&gt;span&lt;/span&gt; &lt;span style="COLOR: rgb(255,0,0)"&gt;id&lt;/span&gt;&lt;span style="COLOR: rgb(0,0,255)"&gt;="Error"&amp;gt;
&lt;/span&gt;            &lt;span style="BACKGROUND: rgb(255,238,98)"&gt;&amp;lt;%&lt;span style="COLOR: rgb(0,0,255)" /&gt;=&lt;/span&gt;ViewData.ContainsDataItem(&lt;span style="COLOR: rgb(163,21,21)"&gt;"Message"&lt;/span&gt;) ? ViewData[&lt;span style="COLOR: rgb(163,21,21)"&gt;"Message"&lt;/span&gt;] + &lt;br /&gt;               &lt;span style="COLOR: rgb(163,21,21)"&gt;"&amp;lt;BR /&amp;gt;"&lt;/span&gt; : &lt;span style="COLOR: rgb(163,21,21)"&gt;""&lt;/span&gt;&lt;span style="BACKGROUND: rgb(255,238,98)"&gt;%&amp;gt;
&lt;/span&gt;        &lt;span style="COLOR: rgb(0,0,255)"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="COLOR: rgb(163,21,21)"&gt;span&lt;/span&gt;&lt;span style="COLOR: rgb(0,0,255)"&gt;&amp;gt;
&lt;/span&gt;        &lt;span style="BACKGROUND: rgb(255,238,98)"&gt;&amp;lt;%&lt;span style="COLOR: rgb(0,0,255)" /&gt;=&lt;/span&gt;Html.SubmitButton(&lt;span style="COLOR: rgb(163,21,21)"&gt;"Submit"&lt;/span&gt;, &lt;span style="COLOR: rgb(163,21,21)"&gt;"Login"&lt;/span&gt;)&lt;span style="BACKGROUND: rgb(255,238,98)"&gt;%&amp;gt;
&lt;/span&gt;    &lt;span style="COLOR: rgb(0,0,255)"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="COLOR: rgb(163,21,21)"&gt;form&lt;/span&gt;&lt;span style="COLOR: rgb(0,0,255)"&gt;&amp;gt;
&lt;/span&gt;&lt;span style="BACKGROUND: rgb(255,238,98)"&gt;&amp;lt;%&lt;/span&gt;}&lt;span style="COLOR: rgb(0,0,255)"&gt;else&lt;/span&gt; {&lt;span style="BACKGROUND: rgb(255,238,98)"&gt;%&amp;gt;
&lt;/span&gt;        &lt;span style="COLOR: rgb(0,0,255)"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: rgb(163,21,21)"&gt;span&lt;/span&gt;&lt;span style="COLOR: rgb(0,0,255)"&gt;&amp;gt;&lt;/span&gt;Not &lt;span style="BACKGROUND: rgb(255,238,98)"&gt;&amp;lt;%&lt;span style="COLOR: rgb(0,0,255)" /&gt;=&lt;/span&gt;Page.User.Identity.Name &lt;span style="BACKGROUND: rgb(255,238,98)"&gt;%&amp;gt;&lt;span style="COLOR: rgb(0,0,255)" /&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: rgb(163,21,21)"&gt;br&lt;/span&gt; &lt;span style="COLOR: rgb(0,0,255)"&gt;/&amp;gt;&lt;/span&gt;    
        &lt;span style="BACKGROUND: rgb(255,238,98)"&gt;&amp;lt;%&lt;span style="COLOR: rgb(0,0,255)" /&gt;=&lt;/span&gt;Html.ActionLink&amp;lt;DevExamples.Controllers.&lt;span style="COLOR: rgb(43,145,175)"&gt;HomeController&lt;/span&gt;&amp;gt;(c =&amp;gt; c.Logout()
            , &lt;span style="COLOR: rgb(163,21,21)"&gt;"Logout"&lt;/span&gt;, &lt;span style="COLOR: rgb(0,0,255)"&gt;new&lt;/span&gt; { id = &lt;span style="COLOR: rgb(163,21,21)"&gt;"LogoutLink"&lt;/span&gt; })&lt;span style="BACKGROUND: rgb(255,238,98)"&gt;%&amp;gt;&lt;span style="COLOR: rgb(0,0,255)" /&gt;&amp;lt;/&lt;/span&gt;&lt;span style="COLOR: rgb(163,21,21)"&gt;span&lt;/span&gt;&lt;span style="COLOR: rgb(0,0,255)"&gt;&amp;gt;

&lt;/span&gt;&lt;span style="BACKGROUND: rgb(255,238,98)"&gt;&amp;lt;%&lt;/span&gt;} &lt;span style="BACKGROUND: rgb(255,238,98)"&gt;%&amp;gt;
&lt;/span&gt;&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;
&lt;p&gt;And added the user control to the masterpage using &lt;/p&gt;
&lt;pre class="code"&gt;&lt;span style="COLOR: rgb(0,0,255)"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: rgb(163,21,21)"&gt;div&lt;/span&gt; &lt;span style="COLOR: rgb(255,0,0)"&gt;id&lt;/span&gt;&lt;span style="COLOR: rgb(0,0,255)"&gt;="Login"&amp;gt;&lt;/span&gt;&lt;span style="BACKGROUND: rgb(255,238,98)"&gt;&amp;lt;%&lt;span style="COLOR: rgb(0,0,255)" /&gt;=&lt;/span&gt;Html.RenderUserControl(&lt;span style="COLOR: rgb(163,21,21)"&gt;"~/Views/Shared/Login.ascx"&lt;/span&gt;) &lt;span style="BACKGROUND: rgb(255,238,98)"&gt;%&amp;gt;&lt;/span&gt;&lt;span style="COLOR: rgb(163,21,21)"&gt;&amp;lt;div&lt;/span&gt;&lt;span style="COLOR: rgb(0,0,255)"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;
&lt;p&gt;I was going to use&lt;/p&gt;
&lt;pre class="code"&gt;&lt;span style="COLOR: rgb(0,0,255)"&gt;using&lt;/span&gt; (Html.Form&amp;lt;DevExamples.Controllers.&lt;span style="COLOR: rgb(43,145,175)"&gt;HomeController&lt;/span&gt;&amp;gt;(c=&amp;gt;c.Login()&lt;br /&gt;   ,System.Web.Mvc.&lt;span style="COLOR: rgb(43,145,175)"&gt;FormExtensions&lt;/span&gt;.&lt;span style="COLOR: rgb(43,145,175)"&gt;FormMethod&lt;/span&gt;.post,&lt;span style="COLOR: rgb(0,0,255)"&gt;new&lt;/span&gt; {id=&lt;span style="COLOR: rgb(163,21,21)"&gt;"LoginForm"&lt;/span&gt;}))&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;
&lt;p&gt;to create the form (because it is a lot cooler), but couldn't get the html attributes to work and was more interested in getting the dynamic stuff working then looking at the code for the extension method in the MVCToolKit, in other words being lazy.&lt;/p&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;
&lt;p&gt;I thought about putting the authentication checking logic into the controller. But handling it this way made it a bit simpler, and more self contained, so until I find a compelling enough reason I will be leaving it this way.&lt;/p&gt;
&lt;p&gt;After I had the user control showing up, I decided to hook up the actual authentication. I decided to go with forms authentication, and set it up using the &lt;a href="http://myheadsexploding.com/images/myheadsexploding_com/WindowsLiveWriter/LoginviaUsercontrolViewjQuery_14D0E/image_4.png"&gt;&lt;img style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" height="19" alt="image" width="20" border="0" src="http://myheadsexploding.com/images/myheadsexploding_com/WindowsLiveWriter/LoginviaUsercontrolViewjQuery_14D0E/image_thumb_1.png" /&gt;&lt;/a&gt; button in the solution explorer. &lt;/p&gt;
&lt;p&gt;Next it was time to create the login and logout controller actions, which I decided would best fit in the HomeController, At first I had thought to create two separate views, one for when logged in and one for logged out, then remembered &lt;a href="http://haacked.com/"&gt;Phil Haack&lt;/a&gt;, at least I think it was him, something about being able to use user controls in the RenderView method of the controller. &lt;/p&gt;
&lt;p&gt;I ended up with the following two controller actions:&lt;/p&gt;
&lt;pre class="code"&gt;[&lt;span style="COLOR: rgb(43,145,175)"&gt;ControllerAction&lt;/span&gt;]
&lt;span style="COLOR: rgb(0,0,255)"&gt;public&lt;/span&gt; &lt;span style="COLOR: rgb(0,0,255)"&gt;void&lt;/span&gt; Login()
{
    &lt;span style="COLOR: rgb(0,0,255)"&gt;if&lt;/span&gt; (!ControllerContext.HttpContext.User.Identity.IsAuthenticated)
    {
        &lt;span style="COLOR: rgb(0,0,255)"&gt;if&lt;/span&gt; (Request.RequestType == &lt;span style="COLOR: rgb(163,21,21)"&gt;"POST"&lt;/span&gt;)
        {
            &lt;span style="COLOR: rgb(0,0,255)"&gt;string&lt;/span&gt; userName = Request.Form[&lt;span style="COLOR: rgb(163,21,21)"&gt;"Username"&lt;/span&gt;];
            &lt;span style="COLOR: rgb(0,0,255)"&gt;string&lt;/span&gt; password = Request.Form[&lt;span style="COLOR: rgb(163,21,21)"&gt;"Password"&lt;/span&gt;];

            &lt;span style="COLOR: rgb(0,0,255)"&gt;if&lt;/span&gt; (&lt;span style="COLOR: rgb(43,145,175)"&gt;Membership&lt;/span&gt;.ValidateUser(userName, password))
            {
                &lt;span style="COLOR: rgb(43,145,175)"&gt;FormsAuthentication&lt;/span&gt;.SetAuthCookie(userName, &lt;span style="COLOR: rgb(0,0,255)"&gt;true&lt;/span&gt;);
                &lt;span style="COLOR: rgb(0,128,0)"&gt;//Set cookie and redirect
&lt;/span&gt;                RedirectToAction(&lt;span style="COLOR: rgb(163,21,21)"&gt;"Login"&lt;/span&gt;);
            }
            &lt;span style="COLOR: rgb(0,0,255)"&gt;else
&lt;/span&gt;            {
                ViewData.Add(&lt;span style="COLOR: rgb(163,21,21)"&gt;"Message"&lt;/span&gt;, &lt;span style="COLOR: rgb(163,21,21)"&gt;"Invalid Username/Password"&lt;/span&gt;);
            }
        }
    }
    RenderView(&lt;span style="COLOR: rgb(163,21,21)"&gt;"Login"&lt;/span&gt;);
}
[&lt;span style="COLOR: rgb(43,145,175)"&gt;ControllerAction&lt;/span&gt;]
&lt;span style="COLOR: rgb(0,0,255)"&gt;public&lt;/span&gt; &lt;span style="COLOR: rgb(0,0,255)"&gt;void&lt;/span&gt; Logout()
{
    &lt;span style="COLOR: rgb(43,145,175)"&gt;FormsAuthentication&lt;/span&gt;.SignOut();
    RedirectToAction(&lt;span style="COLOR: rgb(163,21,21)"&gt;"Login"&lt;/span&gt;);
}
&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;
&lt;p&gt;Since it was allowing me to just render out the user control, I decided there was no point to refreshing the whole page, so decided to use a AJAXish way of doing it. So I decided it was time to pick a javascript library. And since &lt;a href="http://haacked.com/archive/2007/12/13/thank-you-for-helping-me-with-my-job-with-asp.net.aspx"&gt;Phil had provided a link&lt;/a&gt; to  &lt;a href="http://www.chadmyers.com/Blog/archive/2007/12/10/using-script.aculo.us-with-asp.net-mvc.aspx"&gt;Using script.aculo.us with ASP.NET MVC&lt;/a&gt; by Chad Myers,I decided to go with jQuery for this (that and it seemed to fit better). &lt;/p&gt;
&lt;p&gt;After a bit of reading through their tutorials I added this to the header section of the master page.&lt;/p&gt;
&lt;pre class="code"&gt;&lt;span style="COLOR: rgb(0,0,255)"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: rgb(163,21,21)"&gt;script&lt;/span&gt; &lt;span style="COLOR: rgb(255,0,0)"&gt;src&lt;/span&gt;&lt;span style="COLOR: rgb(0,0,255)"&gt;="../../Content/jquery.js"&lt;/span&gt; &lt;span style="COLOR: rgb(255,0,0)"&gt;type&lt;/span&gt;&lt;span style="COLOR: rgb(0,0,255)"&gt;="text/javascript"&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style="COLOR: rgb(163,21,21)"&gt;script&lt;/span&gt;&lt;span style="COLOR: rgb(0,0,255)"&gt;&amp;gt;
&amp;lt;&lt;/span&gt;&lt;span style="COLOR: rgb(163,21,21)"&gt;script&lt;/span&gt; &lt;span style="COLOR: rgb(255,0,0)"&gt;src&lt;/span&gt;&lt;span style="COLOR: rgb(0,0,255)"&gt;="../../Content/jquery.form.js"&lt;/span&gt; &lt;span style="COLOR: rgb(255,0,0)"&gt;type&lt;/span&gt;&lt;span style="COLOR: rgb(0,0,255)"&gt;="text/javascript"&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style="COLOR: rgb(163,21,21)"&gt;script&lt;/span&gt;&lt;span style="COLOR: rgb(0,0,255)"&gt;&amp;gt;
&amp;lt;&lt;/span&gt;&lt;span style="COLOR: rgb(163,21,21)"&gt;script&lt;/span&gt; &lt;span style="COLOR: rgb(255,0,0)"&gt;type&lt;/span&gt;&lt;span style="COLOR: rgb(0,0,255)"&gt;="text/javascript"&amp;gt;
&lt;/span&gt;    &lt;span style="COLOR: rgb(0,0,255)"&gt;var&lt;/span&gt; readyFuncs = &lt;span style="COLOR: rgb(0,0,255)"&gt;function&lt;/span&gt;() { 
        $(&lt;span style="COLOR: rgb(163,21,21)"&gt;'#LoginForm'&lt;/span&gt;).ajaxForm(&lt;span style="COLOR: rgb(0,0,255)"&gt;function&lt;/span&gt;(result) { 
            $(&lt;span style="COLOR: rgb(163,21,21)"&gt;'#Login'&lt;/span&gt;).html(result); 
            $(document).ready(readyFuncs); 
        }); 
        $(&lt;span style="COLOR: rgb(163,21,21)"&gt;'#LogoutLink'&lt;/span&gt;).click(&lt;span style="COLOR: rgb(0,0,255)"&gt;function&lt;/span&gt;(){
            $.&lt;span style="COLOR: rgb(0,0,255)"&gt;get&lt;/span&gt;(&lt;span style="COLOR: rgb(163,21,21)"&gt;'/Home/Logout'&lt;/span&gt;,&lt;span style="COLOR: rgb(0,0,255)"&gt;function&lt;/span&gt;(result){
                $(&lt;span style="COLOR: rgb(163,21,21)"&gt;'#Login'&lt;/span&gt;).html(result);
                $(document).ready(readyFuncs); 
            });
            &lt;span style="COLOR: rgb(0,0,255)"&gt;return&lt;/span&gt; &lt;span style="COLOR: rgb(0,0,255)"&gt;false&lt;/span&gt;;
        });
    };
    $(document).ready(readyFuncs);
&lt;span style="COLOR: rgb(0,0,255)"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="COLOR: rgb(163,21,21)"&gt;script&lt;/span&gt;&lt;span style="COLOR: rgb(0,0,255)"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;The only real snag I had run into with this was that each time the Login div was refreshed I had to reregister the events.&lt;/p&gt;
&lt;div class="wlWriterSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:4dd497a4-51ee-4f9b-a55b-e2bd0856f320" style="PADDING-RIGHT: 0px; DISPLAY: inline; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-TOP: 0px"&gt;Technorati Tags: &lt;a rel="tag" href="http://technorati.com/tags/aspnetmvc"&gt;aspnetmvc&lt;/a&gt;, &lt;a rel="tag" href="http://technorati.com/tags/jQuery"&gt;jQuery&lt;/a&gt;, &lt;a rel="tag" href="http://technorati.com/tags/FormsAuthentication"&gt;FormsAuthentication&lt;/a&gt;&lt;/div&gt;&lt;img src="http://whatstirs.com/blog/aggbug/42.aspx" width="1" height="1" /&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/MyHeadsExploding?a=bjrhs3fwNls:vVyuXMUY2jc:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyHeadsExploding?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/MyHeadsExploding?a=bjrhs3fwNls:vVyuXMUY2jc:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyHeadsExploding?i=bjrhs3fwNls:vVyuXMUY2jc:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/MyHeadsExploding?a=bjrhs3fwNls:vVyuXMUY2jc:dnMXMwOfBR0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyHeadsExploding?d=dnMXMwOfBR0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/MyHeadsExploding?a=bjrhs3fwNls:vVyuXMUY2jc:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyHeadsExploding?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/MyHeadsExploding/~4/bjrhs3fwNls" height="1" width="1"/&gt;</description>
            <dc:creator>Sean Lynch</dc:creator>
            <guid isPermaLink="false">http://whatstirs.com/blog/archive/2008/03/18/login-via-usercontrol-view-jquery.aspx</guid>
            <pubDate>Tue, 18 Mar 2008 15:55:18 GMT</pubDate>
            <wfw:comment>http://whatstirs.com/blog/comments/42.aspx</wfw:comment>
            <comments>http://whatstirs.com/blog/archive/2008/03/18/login-via-usercontrol-view-jquery.aspx#feedback</comments>
            <wfw:commentRss>http://whatstirs.com/blog/comments/commentRss/42.aspx</wfw:commentRss>
        <feedburner:origLink>http://whatstirs.com/blog/archive/2008/03/18/login-via-usercontrol-view-jquery.aspx</feedburner:origLink></item>
        <item>
            <title>Being blocked by internal/private</title>
            <link>http://feedproxy.google.com/~r/MyHeadsExploding/~3/EXf-9YGSVqs/being-blocked-by-internalprivate.aspx</link>
            <description>&lt;p&gt;I ran into a situation that reminded me of Steam Harman's post about &lt;a title="A New Year's Resolution for Developers" href="http://stevenharman.net/blog/archive/2007/12/17/a-new-years-resolution-for-framework-designers.aspx"&gt;A New Year's Resolution for Developers&lt;/a&gt; in which he states that by default methods should be public and virtual unless there is a good reason not to.&lt;/p&gt;
&lt;p&gt;This started when after I decided I was missing functionality like RegisterClientScriptBlock, allowing me to add a client script only if one of the controls needs it, along with only adding it once. I was also missing the ability to use designers.&lt;/p&gt;
&lt;p&gt;To this end, I decided I was going to make a simple server control library with server controls that would provide the functionality found in the MVCToolkit Html extension methods. I also figured it would be nice if I could allow them to function in WebForms as well, if they are on a runat server form tag.&lt;/p&gt;
&lt;p&gt;After a while I found the VerifyRenderingInServerForm method on the Page, which seemed to be the only method available for this. Unfortunately while I can override this method after loading up reflector to see how the base Page was determining that the control is in a form tag, I found that I could only do it with a try/catch around base.VerifyRenderingInServerForm. &lt;/p&gt;
&lt;p&gt;While I don't really have much of a problem doing this, there is a little bit of nagging in the back of my head over the fact that the Page class contains a method called IsInOnFormRender, which has exactly the information I want. Unfortunately this property is internal, preventing me from retrieving efficiently retrieving this information.&lt;/p&gt;
&lt;p&gt;The other problem I find with this is that these server controls would need to run on a special page in order to have the desired functionality, have each of the controls that while have the functionality do the try/catch on VerifyRenderingInServerForm, or use reflection to get access to that variable. None of which are particularly optimal.&lt;/p&gt;
&lt;p&gt;On a side note, I wish I had found this method when I years ago when I was writing the controls of the framework we use at work. Since I could not have our controls running within a runat server form tag because we submit the data through an IFrame, overriding VerifyRenderingInServerForm would have allowed me to stop them from throwing the error.&lt;/p&gt;
&lt;div class="wlWriterSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:60acd2aa-ca7a-4d00-9c0f-1a34a49b9d02" style="PADDING-RIGHT: 0px; DISPLAY: inline; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-TOP: 0px"&gt;Technorati Tags: &lt;a rel="tag" href="http://technorati.com/tags/Inheritance"&gt;Inheritance&lt;/a&gt;, &lt;a rel="tag" href="http://technorati.com/tags/aspnetmvc"&gt;aspnetmvc&lt;/a&gt;&lt;/div&gt;&lt;img src="http://whatstirs.com/blog/aggbug/48.aspx" width="1" height="1" /&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/MyHeadsExploding?a=EXf-9YGSVqs:yjzlSzSGEcg:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyHeadsExploding?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/MyHeadsExploding?a=EXf-9YGSVqs:yjzlSzSGEcg:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyHeadsExploding?i=EXf-9YGSVqs:yjzlSzSGEcg:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/MyHeadsExploding?a=EXf-9YGSVqs:yjzlSzSGEcg:dnMXMwOfBR0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyHeadsExploding?d=dnMXMwOfBR0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/MyHeadsExploding?a=EXf-9YGSVqs:yjzlSzSGEcg:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyHeadsExploding?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/MyHeadsExploding/~4/EXf-9YGSVqs" height="1" width="1"/&gt;</description>
            <dc:creator>Sean Lynch</dc:creator>
            <guid isPermaLink="false">http://whatstirs.com/blog/archive/2008/03/18/being-blocked-by-internalprivate.aspx</guid>
            <pubDate>Tue, 18 Mar 2008 15:54:36 GMT</pubDate>
            <wfw:comment>http://whatstirs.com/blog/comments/48.aspx</wfw:comment>
            <comments>http://whatstirs.com/blog/archive/2008/03/18/being-blocked-by-internalprivate.aspx#feedback</comments>
            <wfw:commentRss>http://whatstirs.com/blog/comments/commentRss/48.aspx</wfw:commentRss>
        <feedburner:origLink>http://whatstirs.com/blog/archive/2008/03/18/being-blocked-by-internalprivate.aspx</feedburner:origLink></item>
        <item>
            <title>Got my nice Urls working</title>
            <category>.Net</category>
            <category>Development</category>
            <category>MS Mvc</category>
            <link>http://feedproxy.google.com/~r/MyHeadsExploding/~3/SxpSrO9sE8w/got-my-nice-urls-working.aspx</link>
            <description>&lt;p&gt;Its amazing how fast things can be done when not fighting bad assumptions. In this case it was that my admin URLs needed to use the nice descriptive URLs, instead of just /[Controller]/[Action]/[id] type routing.&lt;/p&gt; &lt;p&gt;Once I realized I was making things overly complicated I, I ended up with a set of routing functions that are actually a bit less complicated then what I would have come up with if I had been able to extend the RouteTable the way I had planned originally.&lt;/p&gt; &lt;p&gt;I also decided that I didn't like the idea of having the make every category and example name unique. Most of this was that I'm not the creative, but I also realized that it would be really ugly I wanted to have namespaces as categories. For example, it would not have been possible to have both C/System/Windows/Forms/Control and C/System/Web/UI/Control since Control would have had to be unique.&lt;/p&gt; &lt;p&gt;I also decided that I was going to set a limit to the depth of categories that the site was going to have, though it is easy to update this. First I made a function that would generate routes similar to those &lt;a href="http://myheadsexploding.com/archive/2007/12/13/routing-revisited.aspx"&gt;previously posted&lt;/a&gt;. &lt;/p&gt;&lt;pre class="code"&gt;&lt;span style="color: rgb(0,0,255)"&gt;protected&lt;/span&gt; &lt;span style="color: rgb(0,0,255)"&gt;void&lt;/span&gt; CreateRouteSet(&lt;span style="color: rgb(0,0,255)"&gt;string&lt;/span&gt; baseRoute, &lt;span style="color: rgb(0,0,255)"&gt;string&lt;/span&gt; baseName
    , &lt;span style="color: rgb(0,0,255)"&gt;int&lt;/span&gt; maxDepth, &lt;span style="color: rgb(0,0,255)"&gt;object&lt;/span&gt; Defaults)
{
    &lt;span style="color: rgb(43,145,175)"&gt;StringBuilder&lt;/span&gt; sb = &lt;span style="color: rgb(0,0,255)"&gt;new&lt;/span&gt; &lt;span style="color: rgb(43,145,175)"&gt;StringBuilder&lt;/span&gt;();
    &lt;span style="color: rgb(0,0,255)"&gt;for&lt;/span&gt; (&lt;span style="color: rgb(0,0,255)"&gt;int&lt;/span&gt; i = 0; i &amp;lt; maxDepth; i++)
    {
        &lt;span style="color: rgb(0,0,255)"&gt;if&lt;/span&gt; (sb.Length &amp;gt; 0)
            sb.Append(&lt;span style="color: rgb(163,21,21)"&gt;"/"&lt;/span&gt;);

        sb.AppendFormat(&lt;span style="color: rgb(163,21,21)"&gt;"[{0}{1}]"&lt;/span&gt;, baseName, i);

        &lt;span style="color: rgb(43,145,175)"&gt;RouteTable&lt;/span&gt;.Routes.Add(&lt;span style="color: rgb(0,0,255)"&gt;new&lt;/span&gt; &lt;span style="color: rgb(43,145,175)"&gt;Route&lt;/span&gt;{
         
            Url = &lt;span style="color: rgb(43,145,175)"&gt;String&lt;/span&gt;.Format(baseRoute,sb.ToString()),
            Defaults = Defaults,
            RouteHandler = &lt;span style="color: rgb(0,0,255)"&gt;typeof&lt;/span&gt;(&lt;span style="color: rgb(43,145,175)"&gt;MvcRouteHandler&lt;/span&gt;)
        });
    }
}

&lt;span style="color: rgb(0,0,255)"&gt;protected&lt;/span&gt; &lt;span style="color: rgb(0,0,255)"&gt;void&lt;/span&gt; Application_Start(&lt;span style="color: rgb(0,0,255)"&gt;object&lt;/span&gt; sender, &lt;span style="color: rgb(43,145,175)"&gt;EventArgs&lt;/span&gt; e)
{

    CreateRouteSet(&lt;span style="color: rgb(163,21,21)"&gt;"C/{0}"&lt;/span&gt;, &lt;span style="color: rgb(163,21,21)"&gt;"Category"&lt;/span&gt;, 6,
        &lt;span style="color: rgb(0,0,255)"&gt;new&lt;/span&gt; { Action = &lt;span style="color: rgb(163,21,21)"&gt;"Index"&lt;/span&gt;, Controller = &lt;span style="color: rgb(163,21,21)"&gt;"Categories"&lt;/span&gt; }
        );

    &lt;span style="color: rgb(0,128,0)"&gt;//Other routes using the standard [Controller]/[Action]/[Id]&lt;/span&gt;

}&lt;/pre&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;
&lt;p&gt;This will setup routes to handle category hierarchies up to 6 deep.  And add Category1,Category2... into the RouteData.Values collection in the controller.&lt;/p&gt;
&lt;p&gt;Next I set up the code to allow me to handle the route, which I did in the model, adding a method that takes an IDictionary&amp;lt;string,object&amp;gt;. &lt;/p&gt;&lt;pre class="code"&gt;&lt;span style="color: rgb(0,0,255)"&gt;public&lt;/span&gt; &lt;span style="color: rgb(43,145,175)"&gt;Category&lt;/span&gt; GetCategoryFromRouteData(&lt;span style="color: rgb(43,145,175)"&gt;IDictionary&lt;/span&gt;&amp;lt;&lt;span style="color: rgb(43,145,175)"&gt;String&lt;/span&gt;,&lt;span style="color: rgb(0,0,255)"&gt;object&lt;/span&gt;&amp;gt; data)
{
&lt;span style="color: rgb(0,128,0)"&gt;    //Grab just the category data&lt;br /&gt;&lt;/span&gt;    &lt;span style="color: rgb(0,0,255)"&gt;var&lt;/span&gt; navList = &lt;span style="color: rgb(0,0,255)"&gt;from&lt;/span&gt; route &lt;span style="color: rgb(0,0,255)"&gt;in&lt;/span&gt; data
               &lt;span style="color: rgb(0,0,255)"&gt;where&lt;/span&gt; route.Key.IndexOf(&lt;span style="color: rgb(163,21,21)"&gt;"Category"&lt;/span&gt;) == 0
               &lt;span style="color: rgb(0,0,255)"&gt;orderby&lt;/span&gt; route.Key
               &lt;span style="color: rgb(0,0,255)"&gt;select&lt;/span&gt; &lt;span style="color: rgb(0,0,255)"&gt;new&lt;/span&gt;{Key = route.Key, Value = route.Value.ToString()};

    &lt;span style="color: rgb(0,0,255)"&gt;string&lt;/span&gt; sqlSelect = &lt;span style="color: rgb(163,21,21)"&gt;@"
        SELECT {0}.* 
        FROM Category {0}
        {1}
        WHERE {0}.Name = {{0}}"&lt;/span&gt;;
&lt;span style="color: rgb(0,128,0)"&gt;    &lt;br /&gt;    //{{{2}}} will be replaced with {{&amp;lt;param index&amp;gt;}}&lt;br /&gt;&lt;/span&gt;    &lt;span style="color: rgb(0,0,255)"&gt;string&lt;/span&gt; join = &lt;span style="color: rgb(163,21,21)"&gt;@"INNER JOIN Category {0} ON {0}.[Key] = {1}.ParentKey 
                    AND {0}.[Name] = {{{2}}}

&lt;/span&gt;&lt;span style="color: rgb(0,128,0)"&gt;    //This is the name of the category I am actually interested in&lt;br /&gt;&lt;/span&gt;    &lt;span style="color: rgb(0,0,255)"&gt;var&lt;/span&gt; mainCat = navList.Last();

    &lt;span style="color: rgb(0,128,0)"&gt;//Build a list of category values to for parameterized query&lt;br /&gt;    &lt;/span&gt;&lt;span style="color: rgb(43,145,175)"&gt;List&lt;/span&gt;&amp;lt;&lt;span style="color: rgb(0,0,255)"&gt;string&lt;/span&gt;&amp;gt; values = &lt;span style="color: rgb(0,0,255)"&gt;new&lt;/span&gt; &lt;span style="color: rgb(43,145,175)"&gt;List&lt;/span&gt;&amp;lt;&lt;span style="color: rgb(0,0,255)"&gt;string&lt;/span&gt;&amp;gt;();
    values.Add(mainCat.Value);
    &lt;span style="color: rgb(43,145,175)"&gt;StringBuilder&lt;/span&gt; sb = &lt;span style="color: rgb(0,0,255)"&gt;new&lt;/span&gt; &lt;span style="color: rgb(43,145,175)"&gt;StringBuilder&lt;/span&gt;();
    &lt;span style="color: rgb(0,0,255)"&gt;string&lt;/span&gt; lastCategory = mainCat.Key;

    &lt;span style="color: rgb(0,0,255)"&gt;int&lt;/span&gt; i = 1;
    &lt;span style="color: rgb(0,0,255)"&gt;foreach&lt;/span&gt; (&lt;span style="color: rgb(0,0,255)"&gt;var&lt;/span&gt; item &lt;span style="color: rgb(0,0,255)"&gt;in&lt;/span&gt; navList.Reverse().Skip(1))
    {
        sb.AppendFormat(join, item.Key, lastCategory,i++);
        values.Add(item.Value);
        lastCategory = item.Key;
    }

    &lt;span style="color: rgb(0,0,255)"&gt;string&lt;/span&gt; sql = &lt;span style="color: rgb(43,145,175)"&gt;String&lt;/span&gt;.Format(sqlSelect,mainCat.Key, sb.ToString());
    &lt;span style="color: rgb(43,145,175)"&gt;Category&lt;/span&gt; cat = &lt;span style="color: rgb(0,0,255)"&gt;this&lt;/span&gt;.ExecuteQuery&amp;lt;&lt;span style="color: rgb(43,145,175)"&gt;Category&lt;/span&gt;&amp;gt;(sql, values.ToArray()).Single();&lt;br /&gt;
&lt;span style="color: rgb(0,128,0)"&gt;&lt;br /&gt;&lt;br /&gt;    //GetDisplayCategory skips over categories that have only 1 subcategory &lt;br /&gt;    //and no examples, allowing me to have the planned Url structure without &lt;br /&gt;    //&lt;/span&gt;&lt;span style="color: rgb(0,128,0)"&gt;requiring the user to navigate through several empty categories.&lt;br /&gt;&lt;/span&gt;    &lt;span style="color: rgb(0,0,255)"&gt;return&lt;/span&gt; GetDisplayCategory(cat);
}&lt;/pre&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;
&lt;p&gt;I had planned on having doing it all LINQ to SQL expressions, but it was taking more time then it was worth to figure out how to do the hierarchy lookup from the category names.  I need to add some caching of the key lookups at some point, since the joins look like they might get a bit nasty for deep categories, but that can wait.&lt;/p&gt;
&lt;p&gt;I added a few overloads to the HtmlHelper ActionLink extension methods to handle making the nice Url links.&lt;/p&gt;
&lt;p&gt;Now I need to figure out how to deploy the usercontrols that will contain the executable part of the example. I have had some problems with compilation sometimes when I had the website directly upload the usercontrols. Plus I would like them to go into source control when I add them.&lt;/p&gt;
&lt;div class="wlWriterSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:ec42d13d-48c0-4c3f-87a9-08d17c181005" style="padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;Technorati Tags: &lt;a href="http://technorati.com/tags/aspnetmvc" rel="tag"&gt;aspnetmvc&lt;/a&gt;&lt;/div&gt;&lt;img src="http://whatstirs.com/blog/aggbug/46.aspx" width="1" height="1" /&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/MyHeadsExploding?a=SxpSrO9sE8w:fX6UWdSJ3mU:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyHeadsExploding?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/MyHeadsExploding?a=SxpSrO9sE8w:fX6UWdSJ3mU:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyHeadsExploding?i=SxpSrO9sE8w:fX6UWdSJ3mU:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/MyHeadsExploding?a=SxpSrO9sE8w:fX6UWdSJ3mU:dnMXMwOfBR0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyHeadsExploding?d=dnMXMwOfBR0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/MyHeadsExploding?a=SxpSrO9sE8w:fX6UWdSJ3mU:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyHeadsExploding?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/MyHeadsExploding/~4/SxpSrO9sE8w" height="1" width="1"/&gt;</description>
            <dc:creator>Sean Lynch</dc:creator>
            <guid isPermaLink="false">http://whatstirs.com/blog/archive/2008/03/18/got-my-nice-urls-working.aspx</guid>
            <pubDate>Tue, 18 Mar 2008 15:52:52 GMT</pubDate>
            <wfw:comment>http://whatstirs.com/blog/comments/46.aspx</wfw:comment>
            <comments>http://whatstirs.com/blog/archive/2008/03/18/got-my-nice-urls-working.aspx#feedback</comments>
            <slash:comments>4</slash:comments>
            <wfw:commentRss>http://whatstirs.com/blog/comments/commentRss/46.aspx</wfw:commentRss>
        <feedburner:origLink>http://whatstirs.com/blog/archive/2008/03/18/got-my-nice-urls-working.aspx</feedburner:origLink></item>
    </channel>
</rss>
