<feed 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="http://www.w3.org/2005/Atom" xml:lang="en-US">
    <title>Sean Lynch</title>
    <link rel="self" type="application/atom+xml" href="http://sean-lynch.net/blog/Atom.aspx" />
    <subtitle type="html" />
    <id>http://sean-lynch.net/Default.aspx</id>
    <author>
        <name>Sean Lynch</name>
        <uri>http://sean-lynch.net/Default.aspx</uri>
    </author>
    <generator uri="http://subtextproject.com" version="Subtext Version 2.1.1.1">Subtext</generator>
    <updated>2009-10-03T13:07:46Z</updated>
    <entry>
        <title>ScriptControl question</title>
        <link rel="alternate" type="text/html" href="http://sean-lynch.net/archive/2008/07/07/scriptcontrol-question.aspx" />
        <id>http://sean-lynch.net/archive/2008/07/07/scriptcontrol-question.aspx</id>
        <published>2008-07-07T20:09:08Z</published>
        <updated>2008-07-07T20:09:08Z</updated>
        <content type="html">&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://sean-lynch.net/aggbug/58.aspx" width="1" height="1" /&gt;</content>
    </entry>
    <entry>
        <title>Lazy list</title>
        <link rel="alternate" type="text/html" href="http://sean-lynch.net/archive/2008/05/21/lazy-list.aspx" />
        <id>http://sean-lynch.net/archive/2008/05/21/lazy-list.aspx</id>
        <published>2008-05-21T04:34:18Z</published>
        <updated>2008-05-21T04:34:18Z</updated>
        <content type="html">&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://sean-lynch.net/aggbug/57.aspx" width="1" height="1" /&gt;</content>
    </entry>
    <entry>
        <title>Custom Rss Admin feeds</title>
        <link rel="alternate" type="text/html" href="http://sean-lynch.net/archive/2008/04/20/custom-rss-admin-feeds.aspx" />
        <id>http://sean-lynch.net/archive/2008/04/20/custom-rss-admin-feeds.aspx</id>
        <published>2007-09-20T05:55:43Z</published>
        <updated>2007-09-20T05:55:43Z</updated>
        <content type="html">&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://sean-lynch.net/aggbug/36.aspx" width="1" height="1" /&gt;</content>
    </entry>
    <entry>
        <title>.Net based SVN client library</title>
        <link rel="alternate" type="text/html" href="http://sean-lynch.net/archive/2008/03/18/.net-based-svn-client-library.aspx" />
        <id>http://sean-lynch.net/archive/2008/03/18/.net-based-svn-client-library.aspx</id>
        <published>2008-03-18T04:29:01Z</published>
        <updated>2008-03-18T04:29:01Z</updated>
        <content type="html">&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://sean-lynch.net/aggbug/55.aspx" width="1" height="1" /&gt;</content>
    </entry>
    <entry>
        <title>Temp service provider implementation</title>
        <link rel="alternate" type="text/html" href="http://sean-lynch.net/archive/2008/03/18/temp-service-provider-implementation.aspx" />
        <id>http://sean-lynch.net/archive/2008/03/18/temp-service-provider-implementation.aspx</id>
        <published>2007-12-18T16:06:34Z</published>
        <updated>2007-12-18T16:06:34Z</updated>
        <content type="html">&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://sean-lynch.net/aggbug/45.aspx" width="1" height="1" /&gt;</content>
    </entry>
    <entry>
        <title>Login via Usercontrol View + jQuery</title>
        <link rel="alternate" type="text/html" href="http://sean-lynch.net/archive/2008/03/18/login-via-usercontrol-view-jquery.aspx" />
        <id>http://sean-lynch.net/archive/2008/03/18/login-via-usercontrol-view-jquery.aspx</id>
        <published>2007-12-14T05:16:51Z</published>
        <updated>2007-12-14T05:16:51Z</updated>
        <content type="html">&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://sean-lynch.net/aggbug/42.aspx" width="1" height="1" /&gt;</content>
    </entry>
    <entry>
        <title>Being blocked by internal/private</title>
        <link rel="alternate" type="text/html" href="http://sean-lynch.net/archive/2008/03/18/being-blocked-by-internalprivate.aspx" />
        <id>http://sean-lynch.net/archive/2008/03/18/being-blocked-by-internalprivate.aspx</id>
        <published>2008-01-04T05:48:02Z</published>
        <updated>2008-01-04T05:48:02Z</updated>
        <content type="html">&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://sean-lynch.net/aggbug/48.aspx" width="1" height="1" /&gt;</content>
    </entry>
    <entry>
        <title>Got my nice Urls working</title>
        <link rel="alternate" type="text/html" href="http://sean-lynch.net/archive/2008/03/18/got-my-nice-urls-working.aspx" />
        <id>http://sean-lynch.net/archive/2008/03/18/got-my-nice-urls-working.aspx</id>
        <published>2007-12-24T08:44:26Z</published>
        <updated>2007-12-24T08:44:26Z</updated>
        <content type="html">&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://sean-lynch.net/aggbug/46.aspx" width="1" height="1" /&gt;</content>
    </entry>
    <entry>
        <title>Initial thoughts on Microsoft MVC</title>
        <link rel="alternate" type="text/html" href="http://sean-lynch.net/archive/2008/03/18/initial-thoughts-on-microsoft-mvc.aspx" />
        <id>http://sean-lynch.net/archive/2008/03/18/initial-thoughts-on-microsoft-mvc.aspx</id>
        <published>2007-12-12T06:32:19Z</published>
        <updated>2007-12-12T06:32:19Z</updated>
        <content type="html">&lt;p&gt;My first thought is, I really wish I could use this at work, but it is working nicely so far for my rewrite of my web site. Writing Classic ASP style again is taking a little getting used to again though, the visual preview from the designers made styling the page a lot nicer. &lt;/p&gt; &lt;p&gt;The lack of control designers also seem like it would hinder having a graphics guy using Expression Web do the UI with MVC based web applications. But I have never worked with a graphics guy on a project that way anyway so I am could be wrong.&lt;/p&gt; &lt;p&gt; &lt;/p&gt; &lt;p&gt;It would also be nice if the method used by the Route class to parse the Url was virtual, so I could subclass it and allow me to parse something like:&lt;/p&gt; &lt;p&gt;/Example/Simple/Form/MultiPageForm/ShowSource/&lt;/p&gt; &lt;p&gt;to go to the Examples controller, going into the following controller action&lt;/p&gt;&lt;pre class="code"&gt;[&lt;span style="color: rgb(43,145,175)"&gt;ControllerAction&lt;/span&gt;]&lt;br /&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; ShowSource(&lt;span style="color: rgb(0,0,255)"&gt;string&lt;/span&gt;[] Categories, &lt;span style="color: rgb(0,0,255)"&gt;string&lt;/span&gt; ID)
&lt;/pre&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;
&lt;p&gt;which would allow me to have a consistent directory scheme for both the ASP.Net examples, along with the Classic ASP examples that are already available.&lt;/p&gt;
&lt;p&gt;I could probably do something like /Example/Simple_Form/MultiPageForm/ and use [Controller]/[Category]/[ID]/[Action] but I would prefer it to get to the controller action pre-parsed.&lt;/p&gt;
&lt;div class="wlWriterSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:fb560e6c-467d-46c5-9b64-303c801697a9" 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://sean-lynch.net/aggbug/40.aspx" width="1" height="1" /&gt;</content>
    </entry>
    <entry>
        <title>Generic begin/end Html tag extension method</title>
        <link rel="alternate" type="text/html" href="http://sean-lynch.net/archive/2008/03/18/generic-beginend-html-tag-extension-method.aspx" />
        <id>http://sean-lynch.net/archive/2008/03/18/generic-beginend-html-tag-extension-method.aspx</id>
        <published>2007-12-16T05:32:02Z</published>
        <updated>2007-12-16T05:32:02Z</updated>
        <content type="html">&lt;p&gt;After working on the login usercontrol, I decided that I wanted to add similar functionality to the navigation sections of the site for accounts/roles that didn't get ads displayed. So I needed a standard way to put dynamic sections into a page.&lt;/p&gt; &lt;p&gt;I liked the syntax used by the form HtmlHelper methods, so decided to base it off of the SimpleForm class and ended up with this&lt;/p&gt;&lt;pre class="code"&gt;&lt;span style="color: rgb(0,128,0)"&gt;//Based on the SimpleForm class in MvcToolkit &lt;br /&gt;&lt;span style="color: rgb(0,128,0)"&gt;//Wish I believed I would have ever thought to use&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: rgb(0,128,0)"&gt;//IDisposable to do this&lt;/span&gt;&lt;/pre&gt;&lt;pre class="code"&gt;&lt;span style="color: rgb(0,0,255)"&gt;public&lt;/span&gt; &lt;span style="color: rgb(0,0,255)"&gt;class&lt;/span&gt; &lt;span style="color: rgb(43,145,175)"&gt;SimpleWrappingTag&lt;/span&gt; : &lt;span style="color: rgb(43,145,175)"&gt;IDisposable&lt;br /&gt;&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;string&lt;/span&gt; _beginTagFormat = &lt;span style="color: rgb(163,21,21)"&gt;"&amp;lt;{0} {1}&amp;gt;"&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;string&lt;/span&gt; _attributeFormat = &lt;span style="color: rgb(163,21,21)"&gt;"{0}=\"{1}\" "&lt;/span&gt;;
    &lt;span style="color: rgb(0,0,255)"&gt;bool&lt;/span&gt; _startTagRendered = &lt;span style="color: rgb(0,0,255)"&gt;false&lt;/span&gt;;
    &lt;span style="color: rgb(0,0,255)"&gt;bool&lt;/span&gt; _endTagRendered = &lt;span style="color: rgb(0,0,255)"&gt;false&lt;/span&gt;;
    &lt;span style="color: rgb(0,0,255)"&gt;protected&lt;/span&gt; &lt;span style="color: rgb(43,145,175)"&gt;IHttpContext&lt;/span&gt; _context;
    &lt;span style="color: rgb(0,0,255)"&gt;protected&lt;/span&gt; &lt;span style="color: rgb(0,0,255)"&gt;object&lt;/span&gt; _htmlAttributes = &lt;span style="color: rgb(0,0,255)"&gt;null&lt;/span&gt;;


    &lt;span style="color: rgb(0,128,0)"&gt;//Not letting this be modified outside the class for now
&lt;/span&gt;    &lt;span style="color: rgb(0,128,0)"&gt;//might change later
&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;string&lt;/span&gt; TagName { &lt;span style="color: rgb(0,0,255)"&gt;get&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;set&lt;/span&gt;; }


    &lt;span style="color: rgb(0,128,0)"&gt;//Subclassed controls can put their class specific info here
&lt;/span&gt;    &lt;span style="color: rgb(0,0,255)"&gt;public&lt;/span&gt; SimpleWrappingTag(&lt;span style="color: rgb(0,0,255)"&gt;string&lt;/span&gt; tagName)
    {
        &lt;span style="color: rgb(0,0,255)"&gt;this&lt;/span&gt;.TagName = tagName;
    }
    &lt;span style="color: rgb(0,0,255)"&gt;public&lt;/span&gt; SimpleWrappingTag(&lt;span style="color: rgb(0,0,255)"&gt;string&lt;/span&gt; tagName, &lt;span style="color: rgb(43,145,175)"&gt;IHttpContext&lt;/span&gt; context
        , &lt;span style="color: rgb(0,0,255)"&gt;object&lt;/span&gt; htmlAttributes)
    {
        &lt;span style="color: rgb(0,0,255)"&gt;this&lt;/span&gt;.TagName = tagName;
        &lt;span style="color: rgb(0,0,255)"&gt;this&lt;/span&gt;._context = context;
        &lt;span style="color: rgb(0,0,255)"&gt;this&lt;/span&gt;._htmlAttributes = htmlAttributes;
    }

    &lt;span style="color: rgb(128,128,128)"&gt;///&lt;/span&gt;&lt;span style="color: rgb(0,128,0)"&gt; &lt;/span&gt;&lt;span style="color: rgb(128,128,128)"&gt;&amp;lt;summary&amp;gt;
&lt;/span&gt;    &lt;span style="color: rgb(128,128,128)"&gt;///&lt;/span&gt;&lt;span style="color: rgb(0,128,0)"&gt; Creates a StringBuilder and passes it to an overloaded method. 
&lt;/span&gt;    &lt;span style="color: rgb(128,128,128)"&gt;///&lt;/span&gt;&lt;span style="color: rgb(0,128,0)"&gt; Override this method for attributes that should be first in tag.
&lt;/span&gt;    &lt;span style="color: rgb(128,128,128)"&gt;///&lt;/span&gt;&lt;span style="color: rgb(0,128,0)"&gt; &lt;/span&gt;&lt;span style="color: rgb(128,128,128)"&gt;&amp;lt;/summary&amp;gt;
&lt;/span&gt;    &lt;span style="color: rgb(128,128,128)"&gt;///&lt;/span&gt;&lt;span style="color: rgb(0,128,0)"&gt; &lt;/span&gt;&lt;span style="color: rgb(128,128,128)"&gt;&amp;lt;returns&amp;gt;&amp;lt;/returns&amp;gt;
&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;virtual&lt;/span&gt; &lt;span style="color: rgb(43,145,175)"&gt;StringBuilder&lt;/span&gt; BuildAttributeList()
    {
        &lt;span style="color: rgb(0,0,255)"&gt;return&lt;/span&gt; BuildAttributeList(&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;protected&lt;/span&gt; &lt;span style="color: rgb(0,0,255)"&gt;virtual&lt;/span&gt; &lt;span style="color: rgb(43,145,175)"&gt;StringBuilder&lt;/span&gt; BuildAttributeList(&lt;span style="color: rgb(43,145,175)"&gt;StringBuilder&lt;/span&gt; sb)
    {
        sb.Append(_htmlAttributes.ToAttributeList());
        &lt;span style="color: rgb(0,0,255)"&gt;return&lt;/span&gt; sb;
    }
    &lt;span style="color: rgb(0,128,0)"&gt;//Method orginally from SimpleForm, but changed to work with 
&lt;/span&gt;    &lt;span style="color: rgb(0,128,0)"&gt;//BuildAttributeList instead of BuildFormOpenTag
&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; WriteStartTag()
    {
        &lt;span style="color: rgb(0,0,255)"&gt;if&lt;/span&gt; (!&lt;span style="color: rgb(0,0,255)"&gt;this&lt;/span&gt;._startTagRendered)
        {
            &lt;span style="color: rgb(0,0,255)"&gt;string&lt;/span&gt; formTag = &lt;span style="color: rgb(43,145,175)"&gt;String&lt;/span&gt;.Format(&lt;span style="color: rgb(163,21,21)"&gt;"&amp;lt;{0} {1}&amp;gt;"&lt;/span&gt;, TagName
                , BuildAttributeList());
            &lt;span style="color: rgb(0,0,255)"&gt;this&lt;/span&gt;._context.Response.Write(formTag);
        }
    }
    &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; WriteEndTag()
    {
        &lt;span style="color: rgb(0,0,255)"&gt;if&lt;/span&gt; (!&lt;span style="color: rgb(0,0,255)"&gt;this&lt;/span&gt;._endTagRendered)
            &lt;span style="color: rgb(0,0,255)"&gt;this&lt;/span&gt;._context.Response.Write(&lt;span style="color: rgb(43,145,175)"&gt;String&lt;/span&gt;.Format(&lt;span style="color: rgb(163,21,21)"&gt;"&amp;lt;/{0}&amp;gt;"&lt;/span&gt;, TagName));
    }

    &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; Dispose()
    {
        WriteEndTag();
    }
}
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&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;&lt;/pre&gt;
&lt;p&gt;Next I made some trivial, but needed extension methods for the HtmlHelper class.&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(0,0,255)"&gt;static&lt;/span&gt; &lt;span style="color: rgb(0,0,255)"&gt;class&lt;/span&gt; &lt;span style="color: rgb(43,145,175)"&gt;DevExamplesExtensions
&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;static&lt;/span&gt; &lt;span style="color: rgb(43,145,175)"&gt;IDisposable&lt;/span&gt; HtmlTag(&lt;span style="color: rgb(0,0,255)"&gt;this&lt;/span&gt; &lt;span style="color: rgb(43,145,175)"&gt;HtmlHelper&lt;/span&gt; helper, &lt;span style="color: rgb(0,0,255)"&gt;string&lt;/span&gt; tagName)
    {
        &lt;span style="color: rgb(0,0,255)"&gt;return&lt;/span&gt; helper.HtmlTag(tagName, &lt;span style="color: rgb(0,0,255)"&gt;null&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;static&lt;/span&gt; &lt;span style="color: rgb(43,145,175)"&gt;IDisposable&lt;/span&gt; HtmlTag(&lt;span style="color: rgb(0,0,255)"&gt;this&lt;/span&gt; &lt;span style="color: rgb(43,145,175)"&gt;HtmlHelper&lt;/span&gt; helper
        , &lt;span style="color: rgb(0,0,255)"&gt;string&lt;/span&gt; tagName, &lt;span style="color: rgb(0,0,255)"&gt;object&lt;/span&gt; htmlAttributes)
    {
        &lt;span style="color: rgb(43,145,175)"&gt;SimpleWrappingTag&lt;/span&gt; tag =  &lt;span style="color: rgb(0,0,255)"&gt;new&lt;/span&gt; &lt;span style="color: rgb(43,145,175)"&gt;SimpleWrappingTag&lt;/span&gt;(tagName
            , helper.ViewContext.HttpContext, htmlAttributes);
        tag.WriteStartTag();
        &lt;span style="color: rgb(0,0,255)"&gt;return&lt;/span&gt; tag;
    }
}&lt;/pre&gt;
&lt;p&gt;And while I'm satisfied with how this turned out, though I'm hoping to be able to delete the code at some point, I don't like how the code I wrote to implement an Ajax.UpdatePanel method turned out. So I'm not going to post it at the moment.&lt;/p&gt;
&lt;p&gt;But it was going to look something like&lt;/p&gt;
&lt;p&gt;public static UpdatePanel(this AjaxHelper helper, string panelId, ....)&lt;br /&gt;{&lt;br /&gt;   helper.ViewContext.HttpContext.Write("update panel js....");&lt;br /&gt;   IDisposable tag = new HtmlHelper(helper.ViewContext.HttpContext)&lt;br /&gt;        .HtmlTag("div",new { id=panelId});&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;Below is a list of things I couldn't think of a good solution for at the moment&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;I didn't like the fact that I was putting the actual JavaScript into the UpdatePanel extension method. Rob Conery said something on the forums about using services to provide the view with site-wide info that seemed interesting, but not sure of a good way to implement this would be. &lt;br /&gt;&lt;br /&gt;It would be nice to have service providers kind of like you can use in Windows Workflow Foundation or VS control designers, that would let me add a IScriptService to do the actual JavaScript coding based on the script library I wanted to use.&lt;br /&gt;&lt;br /&gt;Maybe I should just create a script provider for this. &lt;br /&gt;&lt;br /&gt;
&lt;/li&gt;&lt;li&gt;Having to pass in a list of "triggering" controls felt kind of clunky. I'm trying to think of the best way to allow me to specify that a Html.ActionLink should register itself with the "UpdatePanel". &lt;br /&gt;&lt;br /&gt;Most of what I think of for this, basically requires me to implement my own versions of the stuff already implemented in the MvcToolkit.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;
&lt;/li&gt;&lt;li&gt;I couldn't come up with a clean way to have the panel in the Usercontrol, but only have it be done if the usercontrol is called from a page instead of as a standalone view. I guess I could have the controller tell it this, but ideally they would just kind of know.&lt;br /&gt;&lt;/li&gt;&lt;/ol&gt;
&lt;p&gt;I think I may have already thought of the solution #3, and a workable #2. But I am really hesitant to do anything with #1 (outside the provider maybe) since I doubt I would do it close enough that I wouldn't need to remove it all to move over to their way, should they implement something like service providers.&lt;/p&gt;
&lt;p&gt;I think I'm going to put this aside for a while on another part of the site, this just is a "nice to have" feature, and get some of the other pieces that I actually need to have for the site done.&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;div class="wlWriterSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:bef9a321-fa1c-4958-9988-76286d94e67d" 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;a href="http://technorati.com/tags/HtmlHelper%20Extensions" rel="tag"&gt;HtmlHelper Extensions&lt;/a&gt;&lt;/div&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;&lt;font size="1"&gt;* 4 actually, but I said how I wished I could &lt;a href="http://myheadsexploding.com/archive/2007/12/06/anonymous-types-and-interfaces.aspx"&gt;implement an interface using an anonymous type&lt;/a&gt;.&lt;/font&gt;&lt;/p&gt;&lt;img src="http://sean-lynch.net/aggbug/43.aspx" width="1" height="1" /&gt;</content>
    </entry>
    <entry>
        <title>Routing revisited</title>
        <link rel="alternate" type="text/html" href="http://sean-lynch.net/archive/2008/03/18/routing-revisited.aspx" />
        <id>http://sean-lynch.net/archive/2008/03/18/routing-revisited.aspx</id>
        <published>2007-12-13T05:12:00Z</published>
        <updated>2007-12-13T05:12:00Z</updated>
        <content type="html">&lt;p&gt;It turned out to be a lot easier to work around not being able to &lt;a href="http://myheadsexploding.com/archive/2007/12/12/initial-thoughts-on-microsoft-mvc.aspx"&gt;override the route parsing method&lt;/a&gt; then I had thought it would be last night. Though when they allow me to override that method I will be changing over.&lt;/p&gt; &lt;p&gt;By setting up the following routes I was able to get almost the effect that I was looking for:&lt;/p&gt;&lt;pre class="code"&gt;&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(163,21,21)"&gt;"Example/[id]/[action]"&lt;/span&gt;,
    Defaults = &lt;span style="color: rgb(0,0,255)"&gt;new&lt;/span&gt; { Controller = &lt;span style="color: rgb(163,21,21)"&gt;"Example"&lt;/span&gt; },
    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(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(163,21,21)"&gt;"Example/[Category1]/[id]/[action]"&lt;/span&gt;,
    Defaults = &lt;span style="color: rgb(0,0,255)"&gt;new&lt;/span&gt; { Controller = &lt;span style="color: rgb(163,21,21)"&gt;"Example"&lt;/span&gt; },
    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(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(163,21,21)"&gt;"Example/[Category1]/[Category2]/[id]/[action]"&lt;/span&gt;,
    Defaults = &lt;span style="color: rgb(0,0,255)"&gt;new&lt;/span&gt; { Controller = &lt;span style="color: rgb(163,21,21)"&gt;"Example"&lt;/span&gt; },
    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;/pre&gt;
&lt;p&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;Though the execute action just takes the id in&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; Execute(&lt;span style="color: rgb(0,0,255)"&gt;string&lt;/span&gt; id)
&lt;/pre&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;
&lt;p&gt;If I find that I actually need access to the Categories found in the path, I can access them using RouteData.Values. It also helps that I had decided that the examples should have a unique ID, that will be a lot like the friendly Urls used in &lt;a href="http://subtextproject.com"&gt;Subtext&lt;/a&gt;. That way the directories are there more for aesthetics then utility. Though when the ability to override the route parsing, I will probably be changing it to this if possible later:&lt;/p&gt;
&lt;p&gt;[&lt;span style="color: rgb(43,145,175)"&gt;ControllerAction&lt;/span&gt;] &lt;br /&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; Execute(&lt;span style="color: rgb(0,0,255)"&gt;string&lt;/span&gt; id, &lt;span style="color: rgb(0,0,255)"&gt;string&lt;/span&gt;[] categories) &lt;/p&gt;
&lt;p&gt;So now that I have the site navigation working the way that I want it, with the exception of a helper method for writing out the longer category listings, its time to work on the maintenance parts of the site.&lt;/p&gt;
&lt;p&gt;And so far it seems that this will be a better fit then WebForms was for the last few reworks of the site, since I can make the UserControls containing the examples completely isolated, including having the runat server form in the control. The only one I liked better was the JSON based one, using ASP.Net AJAX Extensions, which would have gone live if AdSense worked with AJAX/JSON sites.&lt;/p&gt;
&lt;p&gt;Overall the more I use it the more I like the feel of the framework. Especially now that I realized which of these  I wanted to selected when using a master page.&lt;a href="http://myheadsexploding.com/images/myheadsexploding_com/WindowsLiveWriter/MicrosoftMVCandtheRoute_1480D/image_6.png"&gt;&lt;br /&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="46" alt="image" src="http://myheadsexploding.com/images/myheadsexploding_com/WindowsLiveWriter/MicrosoftMVCandtheRoute_1480D/image_thumb_2.png" width="186" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;And so far the best part of the framework is that I don't have to ignore features to not see this dialog after refreshing the page I just navigated to.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://myheadsexploding.com/images/myheadsexploding_com/WindowsLiveWriter/MicrosoftMVCandtheRoute_1480D/image_4.png"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="162" alt="image" src="http://myheadsexploding.com/images/myheadsexploding_com/WindowsLiveWriter/MicrosoftMVCandtheRoute_1480D/image_thumb_1.png" width="307" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p /&gt;
&lt;div class="wlWriterSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:397fa6d3-28ca-4423-8bdc-fba968814994" 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://sean-lynch.net/aggbug/41.aspx" width="1" height="1" /&gt;</content>
    </entry>
    <entry>
        <title>A few simple MVC control suggestions</title>
        <link rel="alternate" type="text/html" href="http://sean-lynch.net/archive/2008/03/18/a-few-simple-mvc-control-suggestions.aspx" />
        <id>http://sean-lynch.net/archive/2008/03/18/a-few-simple-mvc-control-suggestions.aspx</id>
        <published>2008-03-18T03:49:01Z</published>
        <updated>2008-03-18T03:49:01Z</updated>
        <content type="html">&lt;p&gt;I finally got around to updating the website to the MVC preview 2, and ran into a couple of things. &lt;/p&gt; &lt;ol&gt; &lt;li&gt;TagBuilder being internal. While the implementation of it CreateInputTag, CreateTag and CreateAttributeList. The removal of .ToAttributeList() was actually what made me go looking for this. The HtmlExtensionUtility extension methods would have been nice to have also. &lt;br /&gt;&lt;br /&gt;I guess a better way to say it is it would be nice not to have to reimplement the functionality that CreateAttributeList and ConvertObjectToAttributeList already implement.&lt;br /&gt;&lt;/li&gt; &lt;li&gt;It would be nice if SimpleForm inherited from a class, that could be subclassed to make Div and Span tags that have attributes based on routing information. &lt;br /&gt;&lt;br /&gt;Admittedly it is a rather simple to implement what I am &lt;a href="http://myheadsexploding.com/archive/2007/12/16/generic-beginend-html-tag-extension-method.aspx" target="_blank"&gt;talking about&lt;/a&gt; but I think it would be nice to have already there.&lt;/li&gt;&lt;/ol&gt; &lt;p&gt; &lt;/p&gt; &lt;p&gt;I'm still rummaging through the routing stuff, so don't have to much input on those it at the moment. But it looks like I will be able to take all the category discovery information out of my controllers, and just have it passed into the action, which will be nice.&lt;/p&gt; &lt;p&gt;On a side note, after looking at the classes that were made into base classes. I cant really say that I would ever have a need for them to be interfaces. As I can't think of any other class I would want to tack their functionality onto, after all interfaces were the answer to not having multiple inheritance (I still wish I had it multi-inheritance though). &lt;/p&gt; &lt;p&gt;I do however hope that IRouteHandler stays an interface though, because I can see myself taking that behavior onto an object. Just not sure where.&lt;/p&gt; &lt;div class="wlWriterSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:193f68ef-805b-422a-b3a5-7bd6f427bf5f" 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://sean-lynch.net/aggbug/54.aspx" width="1" height="1" /&gt;</content>
    </entry>
    <entry>
        <title>I figured out what I was missing</title>
        <link rel="alternate" type="text/html" href="http://sean-lynch.net/archive/2008/02/06/i-figured-out-what-i-was-missing.aspx" />
        <id>http://sean-lynch.net/archive/2008/02/06/i-figured-out-what-i-was-missing.aspx</id>
        <published>2008-02-06T04:02:06Z</published>
        <updated>2008-02-06T04:02:06Z</updated>
        <content type="html">&lt;p&gt;I figured out what I was missing in &lt;a href="http://myheadsexploding.com/archive/2008/02/05/i-think-im-missing-something.aspx"&gt;I think I'm missing something&lt;/a&gt;. It was using ".Join" instead of ".Where".&lt;/p&gt;
&lt;p&gt;And it turns out that it is a much cleaner implementation then I had done in &lt;a href="http://myheadsexploding.com/archive/2007/12/24/got-my-nice-urls-working.aspx"&gt;Got my nice Urls working&lt;/a&gt;. So here it is.&lt;/p&gt;
&lt;pre class="code"&gt;&lt;span style="COLOR: rgb(0,0,255)"&gt;var&lt;/span&gt; cats = &lt;span style="COLOR: rgb(0,0,255)"&gt;this&lt;/span&gt;.Categories.Where(c =&amp;gt; c.Name == navList.First().Value);
&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.Skip(1))
{
    &lt;span style="COLOR: rgb(0,0,255)"&gt;string&lt;/span&gt; name = item.Value;
    cats = cats.Join(&lt;span style="COLOR: rgb(0,0,255)"&gt;this&lt;/span&gt;.Categories.Where(c =&amp;gt; c.Name == name)
        ,c=&amp;gt;c.Key,c=&amp;gt;c.ParentKey.Value,(c,p)=&amp;gt;p);
} 
cat = cats.First();
&lt;/pre&gt;
&lt;p&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;Which generates the correct Sql bellow&lt;/p&gt;
&lt;p&gt;&lt;a href="http://myheadsexploding.com/images/myheadsexploding_com/WindowsLiveWriter/IfiguredoutwhatIwasmissing_143E6/image_2.png"&gt;&lt;img style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" height="130" alt="image" width="486" border="0" src="http://myheadsexploding.com/images/myheadsexploding_com/WindowsLiveWriter/IfiguredoutwhatIwasmissing_143E6/image_thumb.png" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;Edit:&lt;br /&gt;
Does anyone know if there is a book for LINQ (to SQL in particular) that would be equivilent to Essential Windows Workflow Foundation, that explains how they ended up with the solution they did?&lt;/p&gt;
&lt;div class="wlWriterSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:f5ca9cab-8478-44dd-8643-963b408544cd" 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/LINQ%20to%20SQL"&gt;LINQ to SQL&lt;/a&gt;&lt;/div&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;img src="http://sean-lynch.net/aggbug/51.aspx" width="1" height="1" /&gt;</content>
    </entry>
    <entry>
        <title>IIS 7.0 hosting</title>
        <link rel="alternate" type="text/html" href="http://sean-lynch.net/archive/2008/02/06/iis-7.0-hosting.aspx" />
        <id>http://sean-lynch.net/archive/2008/02/06/iis-7.0-hosting.aspx</id>
        <published>2008-02-06T03:39:21Z</published>
        <updated>2008-02-06T03:39:21Z</updated>
        <content type="html">&lt;p&gt;I am curious if anyone could recommend a hosting company that is running, or has announce when they will be, IIS7 servers now that it is released.&lt;/p&gt; &lt;p&gt;I have looked around &lt;a title="MaximumASP" href="http://myheadsexploding.com/archive/2007/03/31/1.aspx"&gt;MaximumASP&lt;/a&gt;'s site and have yet to find anything regarding a timeframe. Plus I am finding that several smaller shared hosting sites will fill my needs as well as a dedicated or virtual dedicated server does, for a decent amount less.&lt;/p&gt; &lt;p&gt;Preferably, they would not charge a per domain pointer fee.&lt;/p&gt;&lt;img src="http://sean-lynch.net/aggbug/50.aspx" width="1" height="1" /&gt;</content>
    </entry>
    <entry>
        <title>I think I'm missing something</title>
        <link rel="alternate" type="text/html" href="http://sean-lynch.net/archive/2008/02/06/i-think-im-missing-something.aspx" />
        <id>http://sean-lynch.net/archive/2008/02/06/i-think-im-missing-something.aspx</id>
        <published>2008-02-06T03:30:57Z</published>
        <updated>2008-02-06T03:30:57Z</updated>
        <content type="html">&lt;p&gt;I finally found time to work on &lt;a title="DevExamples" href="http://www.devexamples.com"&gt;DevExamples.com&lt;/a&gt; again and thought I would check on the suggestion that Richard had left on &lt;a href="http://myheadsexploding.com/archive/2007/12/24/got-my-nice-urls-working.aspx"&gt;Got my nice Urls working&lt;/a&gt; about using incremental LINQ.&lt;/p&gt; &lt;p&gt;Overall I found that I liked the following syntax much better&lt;/p&gt;&lt;pre class="code"&gt; &lt;span style="color: rgb(0,0,255)"&gt;var&lt;/span&gt; cats = &lt;span style="color: rgb(0,0,255)"&gt;this&lt;/span&gt;.Categories.Where(c =&amp;gt; c.Name == navList.First().Value);
 &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.Skip(1))
 {
  &lt;span style="color: rgb(0,0,255)"&gt;string&lt;/span&gt; name = item.Value;
  cats = cats.Where(c =&amp;gt; c.Name == name);
 } 
 cat = cats.First();
&lt;/pre&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;
&lt;p&gt;Unfortunately this only works for the first parent in the hierarchy. After the first parent, it continues to simply work off of the single join. The problem is that instead of generating &lt;/p&gt;
&lt;p&gt;&lt;a href="http://myheadsexploding.com/images/myheadsexploding_com/WindowsLiveWriter/IthinkImmissingsomething_13C96/image_18.png"&gt;&lt;img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="100" alt="image" src="http://myheadsexploding.com/images/myheadsexploding_com/WindowsLiveWriter/IthinkImmissingsomething_13C96/image_thumb_8.png" width="515" border="0" /&gt;&lt;/a&gt; 
&lt;/p&gt;&lt;p&gt;it is generating 
&lt;/p&gt;&lt;p&gt;&lt;a href="http://myheadsexploding.com/images/myheadsexploding_com/WindowsLiveWriter/IthinkImmissingsomething_13C96/image_14.png"&gt;&lt;img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="75" alt="image" src="http://myheadsexploding.com/images/myheadsexploding_com/WindowsLiveWriter/IthinkImmissingsomething_13C96/image_thumb_6.png" width="516" border="0" /&gt;&lt;/a&gt; 
&lt;/p&gt;&lt;p&gt;I think I understand why I am getting this result, though it was not what I was hoping. 
&lt;/p&gt;&lt;p&gt;In the end I think I will stick with how I implemented it in &lt;a href="http://myheadsexploding.com/archive/2007/12/24/got-my-nice-urls-working.aspx"&gt;Got my nice Urls working&lt;/a&gt; until I either think of, or run into, a way to do it with lambda expression. Plus I like the Sql  generated in the previous post a little better mostly for trace readability.
&lt;/p&gt;&lt;p&gt;&lt;a href="http://myheadsexploding.com/images/myheadsexploding_com/WindowsLiveWriter/IthinkImmissingsomething_13C96/image_12.png"&gt;&lt;img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="130" alt="image" src="http://myheadsexploding.com/images/myheadsexploding_com/WindowsLiveWriter/IthinkImmissingsomething_13C96/image_thumb_5.png" width="503" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;div class="wlWriterSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:eb70ad59-4cf9-44df-ad45-3ba062673b41" style="padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;Technorati Tags: &lt;a href="http://technorati.com/tags/LINQ%20to%20SQL" rel="tag"&gt;LINQ to SQL&lt;/a&gt;&lt;/div&gt;&lt;img src="http://sean-lynch.net/aggbug/49.aspx" width="1" height="1" /&gt;</content>
    </entry>
    <entry>
        <title>I think the 3.5 framework might be the straw</title>
        <link rel="alternate" type="text/html" href="http://sean-lynch.net/archive/2007/12/12/i-think-the-3.5-framework-might-be-the-straw.aspx" />
        <id>http://sean-lynch.net/archive/2007/12/12/i-think-the-3.5-framework-might-be-the-straw.aspx</id>
        <published>2007-12-12T02:41:46Z</published>
        <updated>2007-12-12T02:41:46Z</updated>
        <content type="html">&lt;p&gt;Yesterday my boss had me upgrade the project files of our main app to use Visual Studio 2008. &lt;/p&gt; &lt;p&gt;While doing this the migration wizard asked if I wanted to upgrade the app to work against the .Net 3.5 framework. He had said to just migrate the solution files for now, and later when there was time we would upgrade the framework version.&lt;/p&gt; &lt;p&gt;Then he asked something I hadn't really thought about. &lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;&lt;em&gt;"Does the .Net 3.5 framework support Windows 2000?"&lt;/em&gt;&lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;And its been quite a while since a single question had essentially ruined my day, but this one pretty much had. I guess I should say that it was the "no" that I responded with that really did it, since it meant that it will likely be years until we upgrade it (we officially dropped support for SQL7 around June). The worst part is that not upgrading the framework for the most part the right decision for the company, as many of our existing customers use Windows 2000. &lt;/p&gt; &lt;p&gt;Unlike the 2.0 framework, which because of having our &lt;a href="http://whatstirs.com/archive/2007/09/03/i-think-reading-is-ruining-my-job.aspx"&gt;own framework essentially&lt;/a&gt; I could only really make use of generics, the new features in 3.5 framework (and inclusion of 3.0) had a lot of promise. However, since most of what I wanted to use it for could be done without it the 3.x features with some extra work, I find myself unable to come up with a strong enough case (though I really wish I could) that would counter act the possible loss of existing customers.&lt;/p&gt; &lt;p&gt;Unfortunately there is one other downside to this decision which, because of the environment that my boss has created, I doubt will come up until it is to late. Might expand on this at a later time, but I really want to get back to playing with the &lt;a href="http://weblogs.asp.net/scottgu/archive/2007/12/09/asp-net-3-5-extensions-ctp-preview-released.aspx"&gt;MVC framework&lt;/a&gt; right now.&lt;/p&gt; &lt;p&gt; &lt;/p&gt; &lt;div class="wlWriterSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:478c6f49-e201-4457-ad9c-c081330922a7" style="padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;Technorati Tags: &lt;a href="http://technorati.com/tags/.Net%20Framework%203.5" rel="tag"&gt;.Net Framework 3.5&lt;/a&gt;&lt;/div&gt;&lt;img src="http://sean-lynch.net/aggbug/39.aspx" width="1" height="1" /&gt;</content>
    </entry>
    <entry>
        <title>Anonymous Types and Interfaces</title>
        <link rel="alternate" type="text/html" href="http://sean-lynch.net/archive/2007/12/12/anonymous-types-and-interfaces.aspx" />
        <id>http://sean-lynch.net/archive/2007/12/12/anonymous-types-and-interfaces.aspx</id>
        <published>2007-12-07T03:50:56Z</published>
        <updated>2007-12-07T03:50:56Z</updated>
        <content type="html">&lt;p&gt;I finally had a chance to sit and work with LINQ for a bit, and while it is very cool, a little bit of its luster was lost when I can assign interfaces to the anonymous classes generated by the queries. Meaning I can not do something like:&lt;/p&gt;
&lt;pre class="code"&gt;&lt;font size="2"&gt;&lt;span style="COLOR: rgb(0,0,255)"&gt;public&lt;/span&gt; &lt;span style="COLOR: rgb(0,0,255)"&gt;interface&lt;/span&gt; &lt;/font&gt;&lt;font size="2"&gt;&lt;span style="COLOR: rgb(43,145,175)"&gt;IExample
&lt;/span&gt;{
    &lt;span style="COLOR: rgb(0,0,255)"&gt;string&lt;/span&gt; Name { &lt;span style="COLOR: rgb(0,0,255)"&gt;get&lt;/span&gt;; &lt;span style="COLOR: rgb(0,0,255)"&gt;set&lt;/span&gt;; }
    &lt;span style="COLOR: rgb(0,0,255)"&gt;string&lt;/span&gt; Description { &lt;span style="COLOR: rgb(0,0,255)"&gt;get&lt;/span&gt;; &lt;span style="COLOR: rgb(0,0,255)"&gt;set&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;class&lt;/span&gt; &lt;/font&gt;&lt;font size="2"&gt;&lt;span style="COLOR: rgb(43,145,175)"&gt;DataGenerator
&lt;/span&gt;{
    &lt;span style="COLOR: rgb(0,0,255)"&gt;public&lt;/span&gt; &lt;span style="COLOR: rgb(43,145,175)"&gt;IEnumerable&lt;/span&gt;&amp;lt;&lt;span style="COLOR: rgb(43,145,175)"&gt;IExample&lt;/span&gt;&amp;gt; GetExamples(&lt;span style="COLOR: rgb(0,0,255)"&gt;string&lt;/span&gt; categoryName)
    {&lt;br /&gt;        &lt;/font&gt;&lt;font size="2"&gt;&lt;span style="COLOR: rgb(0,128,0)"&gt;//Context Definition&lt;br /&gt;&lt;/span&gt;        &lt;span style="COLOR: rgb(43,145,175)"&gt;IEnumerable&lt;/span&gt;&amp;lt;&lt;span style="COLOR: rgb(43,145,175)"&gt;IExample&lt;/span&gt;&amp;gt; examples =
            &lt;span style="COLOR: rgb(0,0,255)"&gt;from&lt;/span&gt; x &lt;span style="COLOR: rgb(0,0,255)"&gt;in&lt;/span&gt; db.Examples &lt;/font&gt;&lt;font size="2"&gt;&lt;span style="COLOR: rgb(0,128,0)"&gt;//LINQ to SQL Class&lt;br /&gt;&lt;/span&gt;            &lt;span style="COLOR: rgb(0,0,255)"&gt;where&lt;/span&gt; x.Category.Name = categoryName
            &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; IExamples { Name = x.Name&lt;br /&gt;                                 , Description = x.Description } ;
&lt;span style="COLOR: rgb(0,128,0)"&gt;            // There is probobly better syntax for this&lt;/span&gt;
        &lt;span style="COLOR: rgb(0,0,255)"&gt;return&lt;/span&gt; examples;
    }
}&lt;/font&gt;&lt;/pre&gt;
&lt;p&gt;Now I know I could instead do&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;&lt;span style="COLOR: rgb(0,0,255)"&gt;public&lt;/span&gt; &lt;span style="COLOR: rgb(0,0,255)"&gt;class&lt;/span&gt; &lt;/font&gt;&lt;font size="2"&gt;&lt;span style="COLOR: rgb(43,145,175)"&gt;Example&lt;br /&gt;
&lt;/span&gt;{&lt;br /&gt;
    &lt;span style="COLOR: rgb(0,0,255)"&gt;public&lt;/span&gt; &lt;span style="COLOR: rgb(0,0,255)"&gt;string&lt;/span&gt; Name { &lt;span style="COLOR: rgb(0,0,255)"&gt;get&lt;/span&gt;; &lt;span style="COLOR: rgb(0,0,255)"&gt;set&lt;/span&gt;; }&lt;br /&gt;
    &lt;span style="COLOR: rgb(0,0,255)"&gt;public&lt;/span&gt; &lt;span style="COLOR: rgb(0,0,255)"&gt;string&lt;/span&gt; Description { &lt;span style="COLOR: rgb(0,0,255)"&gt;get&lt;/span&gt;; &lt;span style="COLOR: rgb(0,0,255)"&gt;set&lt;/span&gt;; }&lt;br /&gt;
}&lt;br /&gt;
&lt;span style="COLOR: rgb(0,0,255)"&gt;public&lt;/span&gt; &lt;span style="COLOR: rgb(0,0,255)"&gt;class&lt;/span&gt; &lt;/font&gt;&lt;font size="2"&gt;&lt;span style="COLOR: rgb(43,145,175)"&gt;DataGenerator&lt;br /&gt;
&lt;/span&gt;{&lt;br /&gt;
    &lt;span style="COLOR: rgb(0,0,255)"&gt;public&lt;/span&gt; &lt;span style="COLOR: rgb(43,145,175)"&gt;IEnumerable&lt;/span&gt;&amp;lt;&lt;span style="COLOR: rgb(43,145,175)"&gt;Example&lt;/span&gt;&amp;gt; GetExamples(&lt;span style="COLOR: rgb(0,0,255)"&gt;string&lt;/span&gt; categoryName)&lt;br /&gt;
    {&lt;br /&gt;
        &lt;/font&gt;&lt;font size="2"&gt;&lt;span style="COLOR: rgb(0,128,0)"&gt;//Context Definition&lt;br /&gt;
&lt;/span&gt;        &lt;span style="COLOR: rgb(43,145,175)"&gt;IEnumerable&lt;/span&gt;&amp;lt;&lt;span style="COLOR: rgb(43,145,175)"&gt;Example&lt;/span&gt;&amp;gt; examples =&lt;br /&gt;
            &lt;span style="COLOR: rgb(0,0,255)"&gt;from&lt;/span&gt; x &lt;span style="COLOR: rgb(0,0,255)"&gt;in&lt;/span&gt; db.Examples &lt;/font&gt;&lt;font size="2"&gt;&lt;span style="COLOR: rgb(0,128,0)"&gt;//LINQ to SQL Class, &lt;br /&gt;
&lt;/span&gt;            &lt;span style="COLOR: rgb(0,0,255)"&gt;where&lt;/span&gt; x.Category.Name = categoryName&lt;br /&gt;
            &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; &lt;span style="COLOR: rgb(43,145,175)"&gt;Example&lt;/span&gt;{ Name = x.Name, Description = x.Description };&lt;br /&gt;
&lt;br /&gt;
        &lt;span style="COLOR: rgb(0,0,255)"&gt;return&lt;/span&gt; examples;&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;or if I wanted to continue only exposing an interface&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;pre class="code"&gt;&lt;font size="2"&gt;&lt;span style="COLOR: rgb(0,0,255)"&gt;public&lt;/span&gt; &lt;span style="COLOR: rgb(0,0,255)"&gt;interface&lt;/span&gt; &lt;/font&gt;&lt;font size="2"&gt;&lt;span style="COLOR: rgb(43,145,175)"&gt;IExample
&lt;/span&gt;{
    &lt;span style="COLOR: rgb(0,0,255)"&gt;string&lt;/span&gt; Name { &lt;span style="COLOR: rgb(0,0,255)"&gt;get&lt;/span&gt;; &lt;span style="COLOR: rgb(0,0,255)"&gt;set&lt;/span&gt;; }
    &lt;span style="COLOR: rgb(0,0,255)"&gt;string&lt;/span&gt; Description { &lt;span style="COLOR: rgb(0,0,255)"&gt;get&lt;/span&gt;; &lt;span style="COLOR: rgb(0,0,255)"&gt;set&lt;/span&gt;; }
}
&lt;span style="COLOR: rgb(0,0,255)"&gt;internal &lt;/span&gt;&lt;span style="COLOR: rgb(0,0,255)"&gt;class&lt;/span&gt; &lt;span style="COLOR: rgb(43,145,175)"&gt;Example&lt;/span&gt;:&lt;/font&gt;&lt;font size="2"&gt;&lt;span style="COLOR: rgb(43,145,175)"&gt;IExample
&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;string&lt;/span&gt; Name { &lt;span style="COLOR: rgb(0,0,255)"&gt;get&lt;/span&gt;; &lt;span style="COLOR: rgb(0,0,255)"&gt;set&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;string&lt;/span&gt; Description { &lt;span style="COLOR: rgb(0,0,255)"&gt;get&lt;/span&gt;; &lt;span style="COLOR: rgb(0,0,255)"&gt;set&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;class&lt;/span&gt; &lt;/font&gt;&lt;font size="2"&gt;&lt;span style="COLOR: rgb(43,145,175)"&gt;DataGenerator
&lt;/span&gt;{
    &lt;span style="COLOR: rgb(0,0,255)"&gt;public&lt;/span&gt; &lt;span style="COLOR: rgb(43,145,175)"&gt;IEnumerable&lt;/span&gt;&amp;lt;&lt;span style="COLOR: rgb(43,145,175)"&gt;IExample&lt;/span&gt;&amp;gt; GetExamples(&lt;span style="COLOR: rgb(0,0,255)"&gt;string&lt;/span&gt; categoryName)
    {
        &lt;/font&gt;&lt;font size="2"&gt;&lt;span style="COLOR: rgb(0,128,0)"&gt;//LINQ to SQL Context Definition
&lt;/span&gt;        &lt;span style="COLOR: rgb(43,145,175)"&gt;var&lt;/span&gt; examples =
            &lt;span style="COLOR: rgb(0,0,255)"&gt;from&lt;/span&gt; x &lt;span style="COLOR: rgb(0,0,255)"&gt;in&lt;/span&gt; db.Examples &lt;br /&gt;&lt;/font&gt;&lt;font size="2"&gt;            &lt;span style="COLOR: rgb(0,0,255)"&gt;where&lt;/span&gt; x.Category.Name = categoryName
            &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; &lt;span style="COLOR: rgb(43,145,175)"&gt;Example&lt;/span&gt;{ Name = x.Name&lt;br /&gt;                              , Description = x.Description };

        &lt;span style="COLOR: rgb(0,0,255)"&gt;return&lt;/span&gt; examples.OfType&amp;lt;&lt;span style="COLOR: rgb(43,145,175)"&gt;IExample&lt;/span&gt;&amp;gt;();
    }
}&lt;/font&gt;&lt;/pre&gt;
&lt;p&gt;Over all this isn't a big issue since the second method works just fine for what I am trying to accomplish for the most part. But it feels kind of off having to make a throwaway class to accomplish this.&lt;/p&gt;
&lt;div class="wlWriterSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:64e079e2-7a70-461e-9620-f53e9be4aab2" style="PADDING-RIGHT: 0px; DISPLAY: inline; PADDING-LEFT: 0px; FLOAT: none; PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-TOP: 0px"&gt;Technorati Tags: &lt;a rel="tag" href="http://technorati.com/tags/LINQ"&gt;LINQ&lt;/a&gt;, &lt;a rel="tag" href="http://technorati.com/tags/Anonymous%20Types"&gt;Anonymous Types&lt;/a&gt;, &lt;a rel="tag" href="http://technorati.com/tags/Interface"&gt;Interface&lt;/a&gt;&lt;/div&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;img src="http://sean-lynch.net/aggbug/37.aspx" width="1" height="1" /&gt;</content>
    </entry>
    <entry>
        <title>LINQ, Anonymous Types and Interfaces Revisited</title>
        <link rel="alternate" type="text/html" href="http://sean-lynch.net/archive/2007/12/12/linq-anonymous-types-and-interfaces-revisited.aspx" />
        <id>http://sean-lynch.net/archive/2007/12/12/linq-anonymous-types-and-interfaces-revisited.aspx</id>
        <published>2007-12-09T05:01:47Z</published>
        <updated>2007-12-09T05:01:47Z</updated>
        <content type="html">&lt;p&gt;After making my &lt;a href="http://myheadsexploding.com/archive/2007/12/06/anonymous-types-and-interfaces.aspx"&gt;previous post&lt;/a&gt; I worked on it a bit more, and found that the best way to accomplish what I was trying to do, creating quick data layer that I can change later, was to simply add the IExample interface to the partial class definition. I know I can create this with &lt;a href="http://www.subsonicproject.com"&gt;Subsonic&lt;/a&gt; or another  DAL generator, but currently they aren't on the list of tech I want to learn at the moment. &lt;/p&gt;
&lt;p&gt;And while this did work, I ran into an error in the dbmI designer when I clicked "View Code" from the context menu:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://myheadsexploding.com/images/myheadsexploding_com/WindowsLiveWriter/LINQAnonymousTypesandInterfacesRevisited_14F48/image_4.png"&gt;&lt;img style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" height="121" alt="image" width="317" align="left" border="0" src="http://myheadsexploding.com/images/myheadsexploding_com/WindowsLiveWriter/LINQAnonymousTypesandInterfacesRevisited_14F48/image_thumb_1.png" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;This seems to happen when the project has a default namespace assigned to it or possibly having an Entity Namespace set, since I have both. I haven't looked to much into it since VS puts the partial class definition that it goes to in the cs file of the same name as the dbml file, so I doubt I will be using the view code much anyway.&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;div class="wlWriterSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:3c51c23d-77b1-403c-b4e2-4e7dffe1cf13" 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/LINQ"&gt;LINQ&lt;/a&gt;, &lt;a rel="tag" href="http://technorati.com/tags/Anonymous%20Types"&gt;Anonymous Types&lt;/a&gt;, &lt;a rel="tag" href="http://technorati.com/tags/interface"&gt;interface&lt;/a&gt;&lt;/div&gt;&lt;img src="http://sean-lynch.net/aggbug/38.aspx" width="1" height="1" /&gt;</content>
    </entry>
    <entry>
        <title>HttpHandlers and directory authentication/HttpModules</title>
        <link rel="alternate" type="text/html" href="http://sean-lynch.net/archive/2007/09/20/httphandlers-and-directory-authenticationhttpmodules.aspx" />
        <id>http://sean-lynch.net/archive/2007/09/20/httphandlers-and-directory-authenticationhttpmodules.aspx</id>
        <published>2007-09-16T07:02:14Z</published>
        <updated>2007-09-16T07:02:14Z</updated>
        <content type="html">&lt;p&gt;I decided to implement  &lt;a href="http://sourceforge.net/tracker/index.php?func=detail&amp;amp;aid=1202588&amp;amp;group_id=137896&amp;amp;atid=739982"&gt;Admin Rss Feeds&lt;/a&gt; after a particularly draining Friday. For the most part it went pretty smoothly, and learned something about working with a different team too ;). I Implemented an HttpModule that looked for FormsAuthentication redirects for rss feeds and changed it over to use basic authentication so rss readers could authenticate. &lt;/p&gt;
&lt;p&gt;And for a while all was good. In fact other then unit tests I had thought I was done.&lt;/p&gt;
&lt;p&gt;Then just to be thorough I set up several subfolder blogs off of localhost, and everything stopped working. &lt;strike&gt;Apparently something in the way that the rss HttpHandlers in Subtext are called skips all of the HttpModules set up in the web.config. I have a fix for this, I loop through all of the modules in the application and initialize them.&lt;/strike&gt; I dont think this is the right solution since it also stops the &amp;lt;authorization&amp;gt; section in the /Admin folder is not being looked at either.&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;div class="wlWriterSmartContent" id="0767317B-992E-4b12-91E0-4F059A8CECA8:01cacb3c-28f7-490c-8e55-25f9e502758e" 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/HttpHandler"&gt;HttpHandler&lt;/a&gt;, &lt;a rel="tag" href="http://technorati.com/tags/HttpModule"&gt;HttpModule&lt;/a&gt;, &lt;a rel="tag" href="http://technorati.com/tags/Subtext"&gt;Subtext&lt;/a&gt;&lt;/div&gt;&lt;img src="http://sean-lynch.net/aggbug/33.aspx" width="1" height="1" /&gt;</content>
    </entry>
    <entry>
        <title>Subtext Admin Rss Feeds</title>
        <link rel="alternate" type="text/html" href="http://sean-lynch.net/archive/2007/09/19/subtext-admin-rss-feeds.aspx" />
        <id>http://sean-lynch.net/archive/2007/09/19/subtext-admin-rss-feeds.aspx</id>
        <published>2007-09-19T04:51:43Z</published>
        <updated>2007-09-19T04:51:43Z</updated>
        <content type="html">&lt;p&gt;I just committed the changes to provide 3 administrative rss feeds:&lt;/p&gt; &lt;ul&gt; &lt;li&gt;Comments Needing Moderation&lt;/li&gt; &lt;li&gt;Referrals&lt;/li&gt; &lt;li&gt;Errors&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;The change also uses the HttpModule that will convert forms authentication into basic authentication so that the feeds can be viewed in an Rss reader. After seeing &lt;a title="http://msdn2.microsoft.com/en-us/library/Aa479391.aspx" href="http://msdn2.microsoft.com/en-us/library/Aa479391.aspx"&gt;http://msdn2.microsoft.com/en-us/library/Aa479391.aspx&lt;/a&gt; I had thought about changing over to use it instead of the simple module I wrote. I decided not to however because it would have meshed well with Subtexts security model. &lt;/p&gt; &lt;p&gt;This was one of the more interesting things I have worked on in a while, though I am already thinking of several improvements that could be made (in the next version). These include:&lt;/p&gt; &lt;ul&gt; &lt;li&gt;A module for digest authentication.&lt;/li&gt; &lt;li&gt;A Configuration section for the new authentication modules to allow them to work with other file times outside of rss feeds.&lt;/li&gt; &lt;li&gt;A rework of the way that rss writers are done. Currently a new one needs to be added, along with a HttpHandler when a feed is going to serve up a new object type. It would be nice to be able to configure the feeds using the web.config or setting stored in database to be able to create feeds on any available subtext object collection.&lt;/li&gt; &lt;li&gt;Something seems off with the Error feed's times. I think the local time is being stored without converting it to UTC or specifying a timezone.&lt;/li&gt;&lt;/ul&gt; &lt;p&gt; &lt;/p&gt; &lt;div class="wlWriterSmartContent" id="0767317B-992E-4b12-91E0-4F059A8CECA8:de6fd9b0-b377-4f60-9ccd-62467e18177a" contenteditable="false" style="padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;Technorati Tags: &lt;a href="http://technorati.com/tags/Subtext" rel="tag"&gt;Subtext&lt;/a&gt;, &lt;a href="http://technorati.com/tags/HttpModule" rel="tag"&gt;HttpModule&lt;/a&gt;, &lt;a href="http://technorati.com/tags/Rss" rel="tag"&gt;Rss&lt;/a&gt;&lt;/div&gt;&lt;img src="http://sean-lynch.net/aggbug/35.aspx" width="1" height="1" /&gt;</content>
    </entry>
    <entry>
        <title>HttpHandlers and web.config settings</title>
        <link rel="alternate" type="text/html" href="http://sean-lynch.net/archive/2007/09/16/httphandlers-and-web.config-settings.aspx" />
        <id>http://sean-lynch.net/archive/2007/09/16/httphandlers-and-web.config-settings.aspx</id>
        <published>2007-09-16T20:19:08Z</published>
        <updated>2007-09-16T20:19:08Z</updated>
        <content type="html">&lt;p&gt;I figured out what was happening in my &lt;a title="HttpHandlers and directory authentication/HttpModules" href="http://myheadsexploding.com/archive/2007/09/16/httphandlers-and-directory-authenticationhttpmodules.aspx"&gt;previous post&lt;/a&gt;. It makes a bit more sense now that I have seen it, being able to just stop working on something is handy, basically the Rss feeds don't do URL rewriting. So the call to /test1/Admin/ModeratedCommentRss.aspx uses the /web.config and would use the /test1/Admin/web.config, but it has no reason to look at the /Admin/web.config. &lt;/p&gt;
&lt;p&gt;Not completely sure how I should change this. Right now I have the ModeratedCommentRss.aspx checking to see if the requestor is an Admin, and if not it calls FormsAuthentication.RedirectToLoginPage(). This works, but I would rather a solution that didn't involve people needing to know to put the check in.&lt;/p&gt;
&lt;p&gt;I also found this module helpful when I was figuring out where to do the conversion:  &lt;/p&gt;
&lt;blockquote&gt;
&lt;pre class="code"&gt;&lt;font size="1"&gt;&lt;span style="COLOR: rgb(0,0,255)"&gt;public&lt;/span&gt; &lt;span style="COLOR: rgb(0,0,255)"&gt;class&lt;/span&gt; &lt;span style="COLOR: rgb(43,145,175)"&gt;DebugModule&lt;/span&gt;:System.Web.&lt;/font&gt;&lt;font size="1"&gt;&lt;span style="COLOR: rgb(43,145,175)"&gt;IHttpModule
&lt;/span&gt;{
    &lt;span style="COLOR: rgb(0,0,255)"&gt;public&lt;/span&gt; &lt;span style="COLOR: rgb(43,145,175)"&gt;EventHandler&lt;/span&gt; GetEventhandler(&lt;span style="COLOR: rgb(0,0,255)"&gt;string&lt;/span&gt; name)
    {
        &lt;span style="COLOR: rgb(0,0,255)"&gt;return&lt;/span&gt; &lt;span style="COLOR: rgb(0,0,255)"&gt;new&lt;/span&gt; &lt;span style="COLOR: rgb(43,145,175)"&gt;EventHandler&lt;/span&gt;(&lt;span style="COLOR: rgb(0,0,255)"&gt;delegate&lt;/span&gt;(&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)
        {
            &lt;span style="COLOR: rgb(43,145,175)"&gt;HttpApplication&lt;/span&gt; app = (&lt;span style="COLOR: rgb(43,145,175)"&gt;HttpApplication&lt;/span&gt;)sender;
            &lt;span style="COLOR: rgb(43,145,175)"&gt;HttpContext&lt;/span&gt; context = app.Context;
            &lt;span style="COLOR: rgb(0,0,255)"&gt;if&lt;/span&gt; (context != &lt;span style="COLOR: rgb(0,0,255)"&gt;null&lt;/span&gt;)
                &lt;span style="COLOR: rgb(43,145,175)"&gt;Debug&lt;/span&gt;.WriteIf(context.Response.StatusCode == 302, &lt;span style="COLOR: rgb(163,21,21)"&gt;"Redirecting - "&lt;/span&gt;);
            &lt;span style="COLOR: rgb(43,145,175)"&gt;Debug&lt;/span&gt;.WriteLine(name);
        });
    }

    &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; Init(&lt;span style="COLOR: rgb(43,145,175)"&gt;HttpApplication&lt;/span&gt; app)
    {

        &lt;span style="COLOR: rgb(43,145,175)"&gt;Debug&lt;/span&gt;.WriteLine(&lt;span style="COLOR: rgb(163,21,21)"&gt;"---------------------------------"&lt;/span&gt;);
        &lt;span style="COLOR: rgb(43,145,175)"&gt;Debug&lt;/span&gt;.WriteLine(&lt;span style="COLOR: rgb(163,21,21)"&gt;"Module Init"&lt;/span&gt;);
        &lt;span style="COLOR: rgb(43,145,175)"&gt;Type&lt;/span&gt; appType = app.GetType();
        &lt;span style="COLOR: rgb(43,145,175)"&gt;EventInfo&lt;/span&gt;[] events = appType.GetEvents();
        &lt;span style="COLOR: rgb(0,0,255)"&gt;foreach&lt;/span&gt; (&lt;span style="COLOR: rgb(43,145,175)"&gt;EventInfo&lt;/span&gt; eventInfo &lt;span style="COLOR: rgb(0,0,255)"&gt;in&lt;/span&gt; events)
        {
            eventInfo.AddEventHandler(app, GetEventhandler(eventInfo.Name));
        }
    }
}&lt;/font&gt;&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;I used that class and a small test web project to figure out how to change the FormsAuthentication over to Basic authentication (seems like mixed authentication should have already been there though). &lt;/p&gt;
&lt;p&gt;Of course shortly after I figured most of it out I saw the link to the MSDN article &lt;a href="http://haacked.com/"&gt;Phil Haack&lt;/a&gt; had posted for the feature request.&lt;/p&gt;
&lt;div class="wlWriterSmartContent" id="0767317B-992E-4b12-91E0-4F059A8CECA8:16154e4d-fead-4d98-9c8a-b2763969336f" 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/HttpHandler"&gt;HttpHandler&lt;/a&gt;, &lt;a rel="tag" href="http://technorati.com/tags/HttpModule"&gt;HttpModule&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://sean-lynch.net/aggbug/34.aspx" width="1" height="1" /&gt;</content>
    </entry>
    <entry>
        <title>Blue screen in stereo</title>
        <link rel="alternate" type="text/html" href="http://sean-lynch.net/archive/2007/09/16/blue-screen-in-stereo.aspx" />
        <id>http://sean-lynch.net/archive/2007/09/16/blue-screen-in-stereo.aspx</id>
        <published>2007-09-12T06:10:08Z</published>
        <updated>2007-09-12T06:10:08Z</updated>
        <content type="html">&lt;p&gt;Had my first ever blue screen on my computer at work. Unfortunately, I think this may be foretelling a problem with the machine, since its my first blue screen since I started running XP that wasn't related to video drivers.&lt;/p&gt;
&lt;p&gt; &lt;a atomicselection="true" href="http://myheadsexploding.com/images/myheadsexploding_com/WindowsLiveWriter/Bluescreeninstereo_1E90/DualBluescreen.jpg"&gt;&lt;img style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" height="180" alt="DualBluescreen" width="240" border="0" src="http://myheadsexploding.com/images/myheadsexploding_com/WindowsLiveWriter/Bluescreeninstereo_1E90/DualBluescreen_thumb.jpg" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;The picture really doesn't do it justice, but there really was something impressive and humorous (coworkers really liked it) about seeing this. &lt;/p&gt;
&lt;p&gt;Update: Turned out to be bad memory, so now Im running on 1GB at work (with a fix in the works).&lt;/p&gt;&lt;img src="http://sean-lynch.net/aggbug/32.aspx" width="1" height="1" /&gt;</content>
    </entry>
    <entry>
        <title>Blog Alias Recap</title>
        <link rel="alternate" type="text/html" href="http://sean-lynch.net/archive/2007/09/12/blog-alias-recap.aspx" />
        <id>http://sean-lynch.net/archive/2007/09/12/blog-alias-recap.aspx</id>
        <published>2007-09-12T06:08:41Z</published>
        <updated>2007-09-12T06:08:41Z</updated>
        <content type="html">&lt;p&gt;Well the blog alias feature is in, and the self spam in my referral section has reduced significantly since I started using it last night. Its also nice not seeing Google and Yahoo spidering my blog on 4 different domains (still don't know how they got 2 of them). &lt;/p&gt; &lt;p&gt;&lt;strong&gt;How To Use&lt;/strong&gt;&lt;/p&gt; &lt;ul&gt; &lt;li&gt;Blog edit screen has a list all the domain aliases, and a button to add a new alias. &lt;/li&gt; &lt;li&gt;If an alias is found, redirects request to the associated blog. &lt;/li&gt; &lt;li&gt;Aliases can be at both the host and subfolder level.&lt;br /&gt;&lt;strong&gt;Note:&lt;/strong&gt; Requests are validated against blogs first, so if there is only one blog with a give host name then subfolder aliases would not work.&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;&lt;strong&gt;Lessons&lt;/strong&gt;&lt;/p&gt; &lt;ul&gt; &lt;li&gt;&lt;a href="http://blog.wekeroad.com/"&gt;Rob Conery&lt;/a&gt; is for the most part right &lt;a href="http://blog.wekeroad.com/2007/09/04/in-which-we-discuss-digital-gearheads-and-geek-mastery/"&gt;about the provider model&lt;/a&gt;. Having both a data provider and an object provider with wrapper objects over that on top of that seemed to be a little overkill. But even so, figuring out where to put the changes was one of the more enjoyable parts of the change, which was paid for when I implemented the change. I also learned that it is better then the way we do it at work (think really big Page_Load functions).  &lt;/li&gt; &lt;li&gt;I still don't care much post backs, especially after a pseudo-AJAX/JavaScript framework at work since .Net 1.0. They aren't as bad as I remembered them being, but the refresh popup when navigating is annoying.&lt;/li&gt; &lt;li&gt;Seeing a message appear in my email about the build being broken within 30 minutes of committing is somewhat disheartening. Thankfully it wasn't my code, though it did make me look at aggregate blogs which I had missed when testing.&lt;/li&gt; &lt;li&gt;That I learned far more from making changes to the code then I would have from just reading through it.&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;&lt;strong&gt;Areas for improvement&lt;/strong&gt;&lt;/p&gt; &lt;ul&gt; &lt;li&gt;The formatting of the host admin page could likely be improved some. &lt;/li&gt; &lt;li&gt;Possibly add more validation to prevent overlap of aliases between blogs.&lt;/li&gt; &lt;li&gt;The requests seem a little bit chatty with the database, looks to be something with the lookup for cookie paths.&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;&lt;strong&gt;What's Next&lt;/strong&gt;&lt;/p&gt; &lt;ul&gt; &lt;li&gt;Eyeing&lt;/li&gt; &lt;ul&gt; &lt;li&gt;&lt;a href="http://sourceforge.net/tracker/index.php?func=detail&amp;amp;aid=1552078&amp;amp;group_id=137896&amp;amp;atid=739982"&gt;Excerpt feature&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="http://sourceforge.net/tracker/index.php?func=detail&amp;amp;aid=1467885&amp;amp;group_id=137896&amp;amp;atid=739979"&gt;Changing subfolder breaking pictures&lt;/a&gt;, possibly using the blog aliases to allow for links to be maintained.&lt;/li&gt; &lt;li&gt;&lt;a href="http://sourceforge.net/tracker/index.php?func=detail&amp;amp;aid=1724885&amp;amp;group_id=137896&amp;amp;atid=739979"&gt;Image not defined error in galleries&lt;/a&gt; - have had this happen&lt;/li&gt; &lt;li&gt;&lt;a href="http://sourceforge.net/tracker/index.php?func=detail&amp;amp;aid=1740335&amp;amp;group_id=137896&amp;amp;atid=739982"&gt;Easier affiliate ID integration&lt;/a&gt; - add a set of options that can autopopulate the Sitewide Tracking code surrounded by generated marker comment tags to allow additional code to work. And possibly something to make the amazon links.&lt;/li&gt;&lt;/ul&gt; &lt;li&gt;Looking around for a project that uses WCF to learn from.&lt;/li&gt;&lt;/ul&gt;&lt;img src="http://sean-lynch.net/aggbug/31.aspx" width="1" height="1" /&gt;</content>
    </entry>
    <entry>
        <title>Committing to subtext, blog/domain aliases</title>
        <link rel="alternate" type="text/html" href="http://sean-lynch.net/archive/2007/09/10/committing-to-subtext-blogdomain-aliases.aspx" />
        <id>http://sean-lynch.net/archive/2007/09/10/committing-to-subtext-blogdomain-aliases.aspx</id>
        <published>2007-09-10T05:22:06Z</published>
        <updated>2007-09-10T05:22:06Z</updated>
        <content type="html">&lt;p&gt;Well, I got my first major feature for &lt;a href="http://subtextproject.com/"&gt;Subtext&lt;/a&gt; done, blog/domain aliases for the blog, but I find myself hesitant to click commit. Its not that I doubt it works, it is currently running on my blog right now. I just don't feel comfortable checking in code that I can't respond to problems with for about 19 hours, and would hate to really foobar stuff so soon after getting commit access ;). &lt;/p&gt;
&lt;p&gt;After I do check it in, something along the lines this will be showing in the host admin:&lt;/p&gt;
&lt;p&gt;&lt;a atomicselection="true" href="http://myheadsexploding.com/images/myheadsexploding_com/WindowsLiveWriter/Committingtosubtextblogdomainaliases_1345/image.png"&gt;&lt;img style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" height="176" alt="image" width="324" border="0" src="http://myheadsexploding.com/images/myheadsexploding_com/WindowsLiveWriter/Committingtosubtextblogdomainaliases_1345/image_thumb.png" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;This works a lot like the www prefix currently does. &lt;/p&gt;
&lt;p&gt;So I've decided to wait till tomorrow after work to commit. Will likely type of some what I learned type of post too, mostly to get in the habit.&lt;/p&gt;&lt;img src="http://sean-lynch.net/aggbug/30.aspx" width="1" height="1" /&gt;</content>
    </entry>
    <entry>
        <title>I wish C# 3.0 was here already</title>
        <link rel="alternate" type="text/html" href="http://sean-lynch.net/archive/2007/09/10/i-wish-c-3.0-was-here-already.aspx" />
        <id>http://sean-lynch.net/archive/2007/09/10/i-wish-c-3.0-was-here-already.aspx</id>
        <published>2007-09-10T05:12:44Z</published>
        <updated>2007-09-10T05:12:44Z</updated>
        <content type="html">&lt;p&gt;I was reading &lt;a title="IHttpContext And Other Interfaces For Your Duck Typing Benefit" href="http://haacked.com/archive/2007/09/09/ihttpcontext-and-other-interfaces-for-your-duck-typing-benefit.aspx"&gt;IHttpContext And Other Interfaces For Your Duck Typing Benefit&lt;/a&gt; over on &lt;a href="http://www.haacked.com"&gt;Haacked&lt;/a&gt;. It reminded my of something I did Thursday, which made me wish that .Net 3.5 was already usable.&lt;/p&gt; &lt;p&gt;I actually finally convinced my boss to let me try to automate at least some of the testing. So first order of business, change our the SQL installer program we use to allow it run without user interaction. &lt;/p&gt; &lt;p&gt;After a good amount of refactoring of the monolithic control function, I get that part working. It can now do everything it needs to do by passing in all the stuff I need on the command line. After answering some several questions from the junior developers, several of which they answered them selves during the course of the conversation, I start to move onto making it into something useful.&lt;/p&gt; &lt;p&gt;I decide to make a simple API that I could use to inside of programs, so I can make a quick proof of concept for my boss who is skeptical that it would be feasible to make tests for the SQL (business logic). Something along the lines of here are your options, start and let me know how it went. That's when the fun started, its a single executable file and "needs" to stay that way (which I agree with overall). After my momentary amnesia about not being able to reference exe files, I decide that I am going to use reflection.&lt;/p&gt; &lt;p&gt;My first attempt went something like: &lt;/p&gt; &lt;p&gt; &lt;/p&gt;&lt;blockquote&gt;&lt;pre class="csharpcode"&gt;//The installer has a start method
interface IInstaller{void Start();} 
public IInstaller Bind()
{
	Assembly assembly = Assembly.LoadFile("&amp;lt;Path&amp;gt;");
	Type type = assembly.GetType("namespace.frm");
	ConstructorInfo constructorInfo = type.GetConstructor(new Type[]{});
	IInstaller installer = (IInstaller)constructorInfo.Invoke(new object[]{});
}
&lt;/pre&gt;&lt;/blockquote&gt;
&lt;p /&gt;
&lt;p&gt;That didnt work so well, since while namespace.frm object had a Start method, it wasn't from that interface, and shared no assemblies in common that I could use an interface from. In the end I decided to make a wrapper class that would take the object and make use a delegate to keep a reference to the Start method.&lt;/p&gt;
&lt;p&gt;Something close to this: 
&lt;/p&gt;&lt;blockquote&gt;&lt;pre class="csharpcode"&gt;public interface IInstaller{void Start();}
public class InstallerWrapper:IInstaller
{
	private delegate void StartMethod();
	StartMethod startDelegate;
	object _installer;
	public InstallerWrapper(object installer)
	{
		_installer = installer;
		startDelegate = (StartMethod)Delegate.CreateDelegate(typeof(StartMethod), installer, "Start");
	}
	public void Start()
	{
		startDelegate();	
	}	
}
public IInstaller Bind()
{
	Assembly assembly = Assembly.LoadFile("&amp;lt;Path&amp;gt;");
	Type type = assembly.GetType("namespace.frm");
	ConstructorInfo constructorInfo = type.GetConstructor(new Type[]{});
	return new InstallerWrapper(constructorInfo.Invoke(new object[]{}));
}
&lt;/pre&gt;&lt;/blockquote&gt;
&lt;p /&gt;
&lt;p&gt;Thinking about what I have read about the implementation of it in C# 3.0 I would likely have needed to do it this way anyways, since atleast from what I have read it is a compile time feature. Haven't tested it yet on my VS 2008 beta VM yet though, so I could be wrong. &lt;/p&gt;
&lt;p&gt;Oh, and please forgive the formatting of the code, haven't done it much yet.&lt;/p&gt;&lt;img src="http://sean-lynch.net/aggbug/29.aspx" width="1" height="1" /&gt;</content>
    </entry>
</feed>