<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:copyright="http://blogs.law.harvard.edu/tech/rss" xmlns:image="http://purl.org/rss/1.0/modules/image/">
    <channel>
        <title>Troubleshooting</title>
        <link>http://blog-howto.com/category/26.aspx</link>
        <description>Fixing specific problems</description>
        <language>en-US</language>
        <copyright>Dave's Tech Shop</copyright>
        <managingEditor>blogauthor@davestechshop.net</managingEditor>
        <generator>Subtext Version 1.9.0.27</generator>
        <item>
            <title>Yes We Can Music Video</title>
            <link>http://blog-howto.com/archive/2008/02/08/1835.aspx</link>
            <description>The will.i.am music video "Yes We Can" hit the Net on Friday and by Tuesday it had been streamed a staggering 10 million times on YouTube and the website &lt;a href="http://www.yeswecansong.com/"&gt;www.yeswecansong.com&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
Watch it.&lt;img src="http://blog-howto.com/aggbug/1835.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Dave's Tech Shop</dc:creator>
            <guid>http://blog-howto.com/archive/2008/02/08/1835.aspx</guid>
            <pubDate>Fri, 08 Feb 2008 13:02:13 GMT</pubDate>
            <comments>http://blog-howto.com/archive/2008/02/08/1835.aspx#feedback</comments>
            <slash:comments>2</slash:comments>
            <wfw:commentRss>http://blog-howto.com/comments/commentRss/1835.aspx</wfw:commentRss>
            <trackback:ping>http://blog-howto.com/services/trackbacks/1835.aspx</trackback:ping>
        </item>
        <item>
            <title>Forms Authentication Cookies and Subdomain Names</title>
            <link>http://blog-howto.com/archive/2006/09/21/FormsAuthCookiesAndSubdomainNames.aspx</link>
            <description>&lt;p&gt;Does your ASP.NET web site have subdomains and use forms authentication with persistent cookies? Do you host your site or blog on a shared hosting platform? If so, you can run into a problem authenticating users because of the way cookie domains work. Here are the details of the problem and steps you can take to solve or prevent the problem.&lt;/p&gt;
&lt;h3&gt;Security or Login Problems Can Occur&lt;/h3&gt;
&lt;p&gt;For this example, let's assume you have a blog running blogging software (such as &lt;a target="_blank" href="http://subtextproject.com/"&gt;Subtext&lt;/a&gt;) that supports multiple blogs. Let's also assume you host at WebHost4Life because that is the assumption most articles on this blog have made so far. (However, this example also applies to all web sites with subdomains and forms authentication with cookies and shared hosting.) Say you have the following subdomains set up:&lt;/p&gt;
&lt;ul&gt;
    &lt;li&gt;&lt;strong&gt;http://example.com&lt;/strong&gt; (same as http://www.example.com - this is an aggregated blog or a home page) &lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;http://racing.example.com&lt;/strong&gt; (this is your friend's blog about racing) &lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;http://csharp.example.com&lt;/strong&gt; (this is your blog about C# software development) &lt;/li&gt;
    &lt;li&gt;and there could be any number of &lt;strong&gt;other subdomains&lt;/strong&gt; &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Assume you have user accounts at the aggregated blog (http://example.com) and the other blogs (e.g., http://csharp.example.com). When you log in to any of the blogs at this domain, ASP.NET writes an authentication cookie containing an authentication ticket for your login.&lt;/p&gt;
&lt;h3&gt;The Problem&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Once you log in to &lt;/strong&gt;&lt;strong&gt;http://example.com&lt;/strong&gt;&lt;strong&gt;, you may find that you cannot log in to any of the subdomains&lt;/strong&gt;. This happens because the authentication cookies for specific subdomains have a limited cookie scope. &lt;em&gt;However&lt;/em&gt;, the authentication cookie for http://example.com is available to the primary domain and all subdomains.&lt;/p&gt;
&lt;h3&gt;Why the Problem Occurs&lt;/h3&gt;
&lt;p&gt;Let's say you have logged in to http://example.com earlier. Now you are logging in to http://csharp.example.com. When you log in, ASP.NET creates a FormsAuthenticationTicket with your username and some other information (such as IssueDate, Expiration, Version, etc.). This FormsAuthenticationTicket is stored in a cookie (for the type of configuration we are discussing). WebHost4Life (and probably other shared hosting providers) sets the cookie domain to be the actual domain specified in the URL. This cookie then belongs to that specific subdomain (the one you are logging in to). There are various security mechanisms that enforce this rule. &lt;/p&gt;
&lt;p&gt;In this example, the cookie will be named youruser@csharp.example[1].txt. (The number may not be 1. It is usually 1 or 2.) The cookie will be located at "C:\Documents and Settings\YourUser\Cookies". Your previous cookie (from logging in to the primary domain http://example.com)  will be named similar to youruser@example[1].txt and it will be in the same location.&lt;/p&gt;
&lt;p&gt;After you log in, you are transferred to another page (usually some resource that requires you to have logged in). The request for this page causes ASP.NET to execute code for AuthenticateRequest (or OnAuthenticateRequest in your custom code such as an HttpModule, for example). One thing that happens in that code is that the authentication cookie you created when you logged in is retrieved. The code to retrieve a cookie looks similar to this:&lt;/p&gt;
&lt;p&gt;        HttpContext.Current.Request.Cookies[cookieName]; &lt;/p&gt;
&lt;p&gt;where 'cookieName' is defined in web.config like this:&lt;/p&gt;
&lt;font size="2"&gt;&lt;font size="2"&gt;
&lt;p&gt; &lt;font color="#800000" size="2"&gt;&lt;font color="#0000ff"&gt;&amp;lt;&lt;/font&gt;authentication&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt; &lt;/font&gt;&lt;font color="#ff0000" size="2"&gt;mode&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;=&lt;/font&gt;&lt;font size="2"&gt;"&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;Forms&lt;/font&gt;&lt;font size="2"&gt;"&amp;gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;br /&gt;
  &amp;lt;&lt;/font&gt;&lt;font color="#800000" size="2"&gt;forms&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt; &lt;/font&gt;&lt;font color="#ff0000" size="2"&gt;name&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;=&lt;/font&gt;&lt;font size="2"&gt;"&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;.MyCookieName&lt;/font&gt;&lt;font size="2"&gt;"&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt; &lt;br /&gt;
  &lt;/font&gt;&lt;font color="#ff0000" size="2"&gt;loginUrl&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;=&lt;/font&gt;&lt;font size="2"&gt;"&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;login.aspx&lt;/font&gt;&lt;font size="2"&gt;"&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt; &lt;br /&gt;
  &lt;/font&gt;&lt;font color="#ff0000" size="2"&gt;protection&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;=&lt;/font&gt;&lt;font size="2"&gt;"&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;All&lt;/font&gt;&lt;font size="2"&gt;"&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt; &lt;br /&gt;
  &lt;/font&gt;&lt;font color="#ff0000" size="2"&gt;requireSSL&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;=&lt;/font&gt;&lt;font size="2"&gt;"&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;false&lt;/font&gt;&lt;font size="2"&gt;"&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt; &lt;br /&gt;
  &lt;/font&gt;&lt;font color="#ff0000" size="2"&gt;slidingExpiration&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;=&lt;/font&gt;&lt;font size="2"&gt;"&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;true&lt;/font&gt;&lt;font size="2"&gt;"&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt; &lt;br /&gt;
  &lt;/font&gt;&lt;font color="#ff0000" size="2"&gt;timeout&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;=&lt;/font&gt;&lt;font size="2"&gt;"&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;60&lt;/font&gt;&lt;font size="2"&gt;"&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt; /&amp;gt;&lt;br /&gt;
&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&amp;lt;/&lt;/font&gt;&lt;font color="#800000" size="2"&gt;authentication&lt;font color="#0000ff"&gt;&amp;gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;ASP.NET (or your custom module) will obtain the cookie value and decrypt the authentication ticket. It will then create an instance of an IPrincipal and assign that IPrincipal to HttpContext.Current.User. The IPrincipal will follow your entire request. That's how it should work anyway.&lt;/p&gt;
&lt;p&gt;However, in the situation, the cookie retrieved is the cookie from your previous login to the primary domain. This is the wrong cookie! At least it is wrong for our needs. (However, this behavior is by design. It is not a bug. Any cookie without a subdomain name is available to all subdomains and the primary domain.) This incorrect cookie contains an authentication ticket for the user account at the primary domain. Depending on how your code is written, the IPrincipal user account may not have the correct roles now. It probably doesn't have the correct user name. Obtaining the incorrect authentication ticket can have various serious problems, as you can imagine.&lt;/p&gt;
&lt;h3&gt;The Solution&lt;/h3&gt;
&lt;p&gt;ASP.NET retrieves cookies (within a domain) by name (e.g., ".MyCookieName" as configured above). Configurations like I am describing use the same cookie name for the primary domain and all subdomains. Changing that is one route to a solution -- assuming you do not have control over the cookie domain property, as is currently the case at WebHost4Life.&lt;/p&gt;
&lt;p&gt;If the cookie for http://csharp.example.com had a name similar to .MyCookieName.CSharp, then the normal ASP.NET code that retrieves the authentication cookie would work correctly. However, each subdomain needs a uniquely named cookie &lt;strong&gt;and there is no way to achieve this using the settings in web.config&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;Therefore, you have to implement code to give each authentication cookie a unique name. Here is the approach I took recently. This is from code for the Subtext personal blog publishing platform. I decided to rely on the cookie name configured for forms authentication as the root name and attach various suffixes to this name to distinguish cookies for each subdomain.&lt;/p&gt;
&lt;p&gt;The 3 basic steps I took are:&lt;/p&gt;
&lt;ol&gt;
    &lt;li&gt;Create the unique cookie name; &lt;/li&gt;
    &lt;li&gt;Add the cookie to the response with the correct cookie name; &lt;/li&gt;
    &lt;li&gt;Select the correct cookie by name in AuthenticateRequest. &lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;First, I created a method that would create the suffix and then make a unique cookie name. In the case of Subtext, each subdomain is associated with a specific blog. Therefore, I named the cookies using blog identifiers. In the code below, I get the cookie name configured in web.config, and then I get the blog ID and make a unique cookie name.&lt;/p&gt;
&lt;font size="2"&gt;
&lt;p&gt;&lt;font color="#0000ff" size="2"&gt;private&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;static&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;string&lt;/font&gt;&lt;font size="2"&gt; GetFullCookieName(&lt;/font&gt;&lt;font size="2"&gt;)&lt;br /&gt;
{&lt;br /&gt;
    &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;string&lt;/font&gt;&lt;font size="2"&gt; cookieName = &lt;/font&gt;&lt;font color="#008080" size="2"&gt;FormsAuthentication&lt;/font&gt;&lt;font size="2"&gt;.FormsCookieName;&lt;br /&gt;
    &lt;/font&gt;&lt;font color="#008080" size="2"&gt;StringBuilder&lt;/font&gt;&lt;font size="2"&gt; name = &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;new&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#008080" size="2"&gt;StringBuilder&lt;/font&gt;&lt;font size="2"&gt;(cookieName);&lt;br /&gt;
    name.Append(&lt;/font&gt;&lt;font color="#800000" size="2"&gt;"."&lt;/font&gt;&lt;font size="2"&gt;);&lt;br /&gt;
    &lt;/font&gt;&lt;font size="2"&gt;name.Append(&lt;/font&gt;&lt;font color="#008080" size="2"&gt;Config&lt;/font&gt;&lt;font size="2"&gt;.CurrentBlog == &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;null&lt;/font&gt;&lt;font size="2"&gt; ? &lt;/font&gt;&lt;font color="#800000" size="2"&gt;"null"&lt;/font&gt;&lt;font size="2"&gt; : &lt;/font&gt;&lt;font color="#008080" size="2"&gt;Config&lt;/font&gt;&lt;font size="2"&gt;.CurrentBlog.Id.ToString());&lt;br /&gt;
    &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;return&lt;/font&gt;&lt;font size="2"&gt; name.ToString(); &lt;br /&gt;
}&lt;/font&gt; &lt;/p&gt;
&lt;p&gt;When setting the authentication ticket, I simply call the method above to get the correct (unique) cookie name. I included the entire method because the code shows something else of interest. As &lt;a target="_blank" href="http://www.hanselman.com/blog/AccessingTheASPNETFormsAuthenticationTimeoutValue.aspx"&gt;others&lt;/a&gt; have discovered, there is no good way to directly obtain the timeout value configured in web.config for cookie timeouts. The way I did it is by having ASP.NET make a temporary authentication cookie for me and then copying the timeout data (and other information too) from that temporary cookie. Once that is done, I simply set the correct cookie name and add the cookie to the response.&lt;/p&gt;
&lt;p&gt;NOTE: In ASP.NET 2.0, you may think you can use the strongly typed configuration classes to access values such as the authentication cookie timeout. However, that will not work in partial trust. You are making sure your web app will run in partial trust, right? If you don't want to take my approach for accessing the cookie timeout value, you could duplicate the web.config setting for forms authentication timeout in the appSettings section of your web.config file. Having the same value configured in two places is not ideal, however. That's why I chose the method shown below.&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;&lt;font color="#0000ff" size="2"&gt;public&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;static&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;void&lt;/font&gt;&lt;font size="2"&gt; SetAuthenticationTicket(&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;string&lt;/font&gt;&lt;font size="2"&gt; username, &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;bool&lt;/font&gt;&lt;font size="2"&gt; persist, &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;params&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;string &lt;/font&gt;&lt;font size="2"&gt;userData)&lt;br /&gt;
{&lt;br /&gt;
    &lt;/font&gt;&lt;font color="#008000" size="2"&gt;//Getting a cookie this way and using a temp auth ticket &lt;br /&gt;
    &lt;/font&gt;&lt;font color="#008000" size="2"&gt;//allows us to access the timeout value from web.config in partial trust.&lt;br /&gt;
    &lt;/font&gt;&lt;font color="#008080" size="2"&gt;HttpCookie&lt;/font&gt;&lt;font size="2"&gt; authCookie = &lt;/font&gt;&lt;font color="#008080" size="2"&gt;FormsAuthentication&lt;/font&gt;&lt;font size="2"&gt;.GetAuthCookie(username, persist);&lt;br /&gt;
    &lt;/font&gt;&lt;font color="#008080" size="2"&gt;FormsAuthenticationTicket&lt;/font&gt;&lt;font size="2"&gt; tempTicket = &lt;/font&gt;&lt;font color="#008080" size="2"&gt;FormsAuthentication&lt;/font&gt;&lt;font size="2"&gt;.Decrypt(authCookie.Value);&lt;br /&gt;
    &lt;/font&gt;&lt;font color="#008080" size="2"&gt;FormsAuthenticationTicket&lt;/font&gt;&lt;font size="2"&gt; authTicket = &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;new&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#008080" size="2"&gt;FormsAuthenticationTicket&lt;/font&gt;&lt;font size="2"&gt;(&lt;br /&gt;
        &lt;/font&gt;&lt;font size="2"&gt;tempTicket.Version, tempTicket.Name, tempTicket.IssueDate,&lt;br /&gt;
        tempTicket.Expiration,&lt;/font&gt;&lt;font color="#008000" size="2"&gt;//this is how we access the configured timeout value&lt;br /&gt;
        &lt;/font&gt;&lt;font size="2"&gt;persist, &lt;/font&gt;&lt;font size="2"&gt;userData, &lt;/font&gt;&lt;font size="2"&gt;tempTicket.CookiePath);&lt;br /&gt;
    authCookie.Value = &lt;/font&gt;&lt;font color="#008080" size="2"&gt;FormsAuthentication&lt;/font&gt;&lt;font size="2"&gt;.Encrypt(authTicket);&lt;br /&gt;
    authCookie.Name = GetFullCookieName();&lt;/font&gt;&lt;font color="#008000" size="2"&gt;//use our custom cookie name&lt;br /&gt;
    &lt;/font&gt;&lt;font color="#008080" size="2"&gt;HttpContext&lt;/font&gt;&lt;font size="2"&gt;.Current.Response.Cookies.Add(authCookie);&lt;br /&gt;
}&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;font size="2"&gt;
&lt;p&gt;ASP.NET can exhibit some bizarre behavior when it comes to cookies. Cookies can disappear during debugging and cookies can even be created out of thin air. In fact, the innocent act of getting a cookie from the Response cookie collection can create a cookie in the Request cookie collection! &lt;a target="_blank" href="http://www.codeproject.com/aspnet/aspnetcookies.asp?df=100&amp;amp;forumid=13312&amp;amp;exp=0&amp;amp;fr=26"&gt;Here&lt;/a&gt; is an excellent article by Paul Riley that covers all the details of those gotchas. Now, back to the specific solution.&lt;/p&gt;
&lt;p&gt;In your code that handles AuthenticateRequest, you need a way to select the correct authentication cookie by name. I used a method called SelectAuthenticationCookie. The code below shows the call site.&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font size="2"&gt;&lt;font color="#0000ff" size="2"&gt;void&lt;/font&gt;&lt;font size="2"&gt; OnAuthenticateRequest(&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;object&lt;/font&gt;&lt;font size="2"&gt; sender, &lt;/font&gt;&lt;font color="#008080" size="2"&gt;EventArgs&lt;/font&gt;&lt;font size="2"&gt; e)&lt;br /&gt;
{&lt;br /&gt;
    &lt;/font&gt;&lt;font color="#008080" size="2"&gt;HttpCookie&lt;/font&gt;&lt;font size="2"&gt; authCookie = Subtext.Framework.&lt;/font&gt;&lt;font color="#008080" size="2"&gt;Security&lt;/font&gt;&lt;font size="2"&gt;.SelectAuthenticationCookie();&lt;br /&gt;
    //the rest of your authetication code would follow this.&lt;br /&gt;
}&lt;/font&gt;&lt;/font&gt;&lt;/font&gt; &lt;/p&gt;
&lt;p&gt;The method is implemented as shown below. Note that it uses the same GetFullCookieName method created above. In the code below, I use a for-loop, but I assume you may want to use some other type of loop (foreach?). I am trusting the jitter to handle the multiple calls to GetFullCookieName efficiently.&lt;/p&gt;
&lt;p&gt;&lt;font color="#0000ff" size="2"&gt;public&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;static&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#008080" size="2"&gt;HttpCookie&lt;/font&gt;&lt;font size="2"&gt; SelectAuthenticationCookie()&lt;br /&gt;
{&lt;br /&gt;
&lt;/font&gt;&lt;font color="#008080" size="2"&gt;    HttpCookie&lt;/font&gt;&lt;font size="2"&gt; authCookie = &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;null&lt;/font&gt;&lt;font size="2"&gt;;&lt;br /&gt;
&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;    for&lt;/font&gt;&lt;font size="2"&gt; (&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;int&lt;/font&gt;&lt;font size="2"&gt; i = 0; i &amp;lt; &lt;/font&gt;&lt;font color="#008080" size="2"&gt;HttpContext&lt;/font&gt;&lt;font size="2"&gt;.Current.Request.Cookies.Count; ++i)&lt;br /&gt;
    {&lt;br /&gt;
&lt;/font&gt;&lt;font color="#008080" size="2"&gt;        HttpCookie&lt;/font&gt;&lt;font size="2"&gt; c = &lt;/font&gt;&lt;font color="#008080" size="2"&gt;HttpContext&lt;/font&gt;&lt;font size="2"&gt;.Current.Request.Cookies[i];&lt;br /&gt;
&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;        if&lt;/font&gt;&lt;font size="2"&gt; (c.Name == GetFullCookieName())&lt;br /&gt;
        {&lt;br /&gt;
            authCookie = c;&lt;br /&gt;
&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;           break&lt;/font&gt;&lt;font size="2"&gt;;&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;    return&lt;/font&gt;&lt;font size="2"&gt; authCookie;&lt;br /&gt;
}&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;As you can see, the code sets and gets the cookie by using the same GetFullCookieName method. That's all it takes to solve this problem.&lt;/p&gt;
&lt;p&gt;If you want to look at a running example of the code, go to the &lt;a target="_blank" href="http://sourceforge.net/projects/subtext"&gt;Subtext project&lt;/a&gt; and use &lt;a target="_blank" href="http://subversion.tigris.org/"&gt;Subversion&lt;/a&gt; to get rev 1762 or later of release 1.9, which is currently located at &lt;a href="https://svn.sourceforge.net/svnroot/subtext/branches/Release1.9/"&gt;https://svn.sourceforge.net/svnroot/subtext/branches/Release1.9/&lt;/a&gt;. (FYI, I assume this code will change completely in Subtext 2.0 when it is released. It could change before that.)&lt;/p&gt;
&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;img src="http://blog-howto.com/aggbug/249.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Dave's Tech Shop</dc:creator>
            <guid>http://blog-howto.com/archive/2006/09/21/FormsAuthCookiesAndSubdomainNames.aspx</guid>
            <pubDate>Thu, 21 Sep 2006 22:40:51 GMT</pubDate>
            <comments>http://blog-howto.com/archive/2006/09/21/FormsAuthCookiesAndSubdomainNames.aspx#feedback</comments>
            <wfw:commentRss>http://blog-howto.com/comments/commentRss/249.aspx</wfw:commentRss>
            <trackback:ping>http://blog-howto.com/services/trackbacks/249.aspx</trackback:ping>
        </item>
        <item>
            <title>Cannot log in to blog in Subtext 1.9 with multiple blogs</title>
            <link>http://blog-howto.com/archive/2006/09/17/SubtextCookieNotDeleted.aspx</link>
            <description>&lt;p&gt;A reader just emailed me and asked about a problem logging to to his blogs. It turns out that I have been wrestling with this issue for a week or more and I have heard from a couple &lt;a target="_blank" href="http://sourceforge.net/forum/forum.php?thread_id=1573135&amp;amp;forum_id=464968"&gt;other&lt;/a&gt; people having the same problem in the last few days.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Here is a description of the problem:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;If you have multiple blogs configured in Subtext 1.9, you may experience a situation where you &lt;a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&amp;amp;aid=1559885&amp;amp;group_id=137896&amp;amp;atid=739979"&gt;cannot log in&lt;/a&gt; as the admin to one or more of your blogs.&lt;/p&gt;
&lt;p&gt;The problem appears to only happen when those multiple blogs are configured using subdomain names. For example:&lt;/p&gt;
&lt;ul&gt;
    &lt;li&gt;mydomain.com &lt;/li&gt;
    &lt;li&gt;blog1.mydomain.com &lt;/li&gt;
    &lt;li&gt;blog2.mydomain.com &lt;/li&gt;
    &lt;li&gt;blog3.mydomain.com &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The problem is related to the fact that one of the blogs is accessible at the primary domain without any subdomain:&lt;/p&gt;
&lt;ul&gt;
    &lt;li&gt;http://mydomain.com &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Some shared hosting providers are apparently specifying the ASP.NET cookie domain property outside of the application's code (where the application is Subtext in this case). That means that when you access your blog using &lt;a href="http://mydomain.com/"&gt;http://mydomain.com&lt;/a&gt; and the cookie domain property has been set, that cookie will essentially "hide" all your other authentication cookies as far as Subtext is concerned. &lt;/p&gt;
&lt;p&gt;[UPDATE Sept 2006] The latest Subtext code should solve this problem. &lt;a href="http://blog-howto.com/archive/2006/09/21/FormsAuthCookiesAndSubdomainNames.aspx"&gt;Here&lt;/a&gt; is an article explaining the approach I took. I have only tested the solution at WebHost4Life so far. If you build Subtext from the source code, you can try this solution out yourself. If you do that, please give us some feedback. If the testing goes well, this solution should be part of the next Subtext release (which will be v1.9.1 I believe).&lt;/p&gt;
&lt;h3&gt;To solve the problem, follow these steps:&lt;/h3&gt;
&lt;p&gt;On the computer you are using to access your blog, go to:&lt;/p&gt;
&lt;p&gt; C:\Documents and Settings\&lt;strong&gt;&lt;font color="#ff0000"&gt;YourUserName&lt;/font&gt;&lt;/strong&gt;\Cookies&lt;/p&gt;
&lt;p&gt;Search for any cookies that have your blog's domain name in them. I search on file names that include the term "mydomain" where my blogs are named as shown above.&lt;/p&gt;
&lt;p&gt;Delete all the cookies.&lt;/p&gt;
&lt;p&gt;Close any open browser windows.&lt;/p&gt;
&lt;p&gt;Now try to log in to your blog as admin. You should have success. If not, you may need to repeat the steps and verify the all the Subtext cookies are deleted. They all have the name ".SubtextCookie" inside them. Searching inside the content of the cookies is another way to perform the search I mentioned above.&lt;/p&gt;
&lt;p&gt;I have now tested this solution several times. Once I delete the cookies and close my browser, I am once again able to log in.&lt;/p&gt;
&lt;p&gt;The problem happens as soon as Subtext writes a cookie to my system with this file name:&lt;/p&gt;
&lt;p&gt;MyUserName@mydomain[n].txt where n is usually 1.&lt;/p&gt;
&lt;p&gt;There may be other cookies that exist with names such as:&lt;/p&gt;
&lt;ul&gt;
    &lt;li&gt;MyUserName@&lt;strong&gt;blog3&lt;/strong&gt;.mydomain[n].txt &lt;/li&gt;
    &lt;li&gt;MyUserName@&lt;strong&gt;blog2&lt;/strong&gt;.mydomain[n].txt &lt;/li&gt;
    &lt;li&gt;MyUserName@&lt;strong&gt;blog1&lt;/strong&gt;.mydomain[n].txt &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;As soon as the cookie without the subdomain name gets written, the login problem occurs&lt;/strong&gt;. In fact, the cookie without the subdomain name is the only one that needs to be deleted.&lt;/p&gt;
&lt;p&gt;Logging in as HostAdmin using a URL without a subdomain can also create this cookie without a subdomain name, and once that happens, the same Admin login problem will occur.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;font color="#ff0000"&gt;Any time you cannot log in, you will need to repeat these steps to delete the Subtext cookie!&lt;/font&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;I am fairly sure this issue will be fixed in Subtext very soon. For now, the above work-around should help.&lt;/p&gt;&lt;img src="http://blog-howto.com/aggbug/230.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Dave's Tech Shop</dc:creator>
            <guid>http://blog-howto.com/archive/2006/09/17/SubtextCookieNotDeleted.aspx</guid>
            <pubDate>Sun, 17 Sep 2006 16:34:28 GMT</pubDate>
            <comments>http://blog-howto.com/archive/2006/09/17/SubtextCookieNotDeleted.aspx#feedback</comments>
            <wfw:commentRss>http://blog-howto.com/comments/commentRss/230.aspx</wfw:commentRss>
            <trackback:ping>http://blog-howto.com/services/trackbacks/230.aspx</trackback:ping>
        </item>
        <item>
            <title>Troubleshooting - Using log4net</title>
            <link>http://blog-howto.com/archive/2006/09/15/UsingLog4NetAtWH4L.aspx</link>
            <description>&lt;p&gt;When your blog is having technical &lt;em&gt;issues&lt;/em&gt; it often helps to look at a log of errors. This is especially true when using a remote shared host that you have limited access to.&lt;/p&gt;
&lt;p&gt;This article describes how to get &lt;a target="_blank" href="http://www.subtextproject.com/"&gt;Subtext&lt;/a&gt;'s built-in logging enabled at WebHost4Life. Subtext uses &lt;a target="_blank" href="http://logging.apache.org/log4net/"&gt;log4net&lt;/a&gt; as the logging provider. Among the many logging options, log4net can send error messages to you by email and it can log errors to the Subtext database. However, the easiest solution when nothing seems to be working is to log to a &lt;strong&gt;file&lt;/strong&gt;. (Otherwise you may find yourself troubleshooting email or database connections in addition to whatever you were initially trying to fix. When logging to a file, you don't have to have a working db connection or mail server configured yet.)&lt;/p&gt;
&lt;p&gt;Unfortunately, I recently had a situation where I could not even get logging to a file to work. That motivated me to create this article. &lt;/p&gt;
&lt;h3&gt;Here are the steps to get log4net to log to a file on your shared hosting account at WH4L.&lt;/h3&gt;
&lt;ol&gt;
    &lt;li&gt;Log in to your &lt;a target="_blank" href="http://blog-howto.com/archive/2006/09/07/HowToSetupWebHostingSTHW4L.aspx"&gt;WH4L&lt;/a&gt; &lt;a target="_blank" href="https://controlpanel.mysite4now.com/wcp/default.asp?wh=1"&gt;Control Panel.&lt;/a&gt; &lt;/li&gt;
    &lt;li&gt;Create a folder under your Subtext installation folder (usually Subtext.Web) called Logs. &lt;/li&gt;
    &lt;li&gt;Follow the instructions &lt;a href="http://blog-howto.com/archive/2006/09/15/FilePermissionsForImageUploading.aspx"&gt;here&lt;/a&gt; to change file permissions on the Logs folder so that the Network Service user account has write permissions to the Logs folder. &lt;/li&gt;
    &lt;li&gt;Find and edit the file &lt;font face="Arial"&gt;Log4Net.config. It is in your Subtext installation folder (usually Subtext.Web).&lt;br /&gt;
    Add the following block of code right under the &amp;lt;log4net&amp;gt; element opening tag:&lt;br /&gt;
    &lt;br /&gt;
    &lt;font face="Arial"&gt;  &amp;lt;appender name="FileAppender" type="log4net.Appender.FileAppender"&amp;gt;&lt;br /&gt;
        &amp;lt;param name="File" value="c:&lt;strong&gt;&lt;font color="#ff0000"&gt;\\&lt;/font&gt;&lt;/strong&gt;hosting\\webhost4life\\member\\&lt;strong&gt;your_account&lt;/strong&gt;\\Subtext.Web\\Logs\\your_blog.log"/&amp;gt;&lt;br /&gt;
        &amp;lt;param name="AppendToFile" value="true"/&amp;gt;&lt;br /&gt;
        &amp;lt;layout type="log4net.Layout.PatternLayout"&amp;gt;&lt;br /&gt;
          &amp;lt;conversionPattern value="%-5p %m [%r] %d{ABSOLUTE}%n"/&amp;gt;&lt;br /&gt;
        &amp;lt;/layout&amp;gt;&lt;br /&gt;
      &amp;lt;/appender&amp;gt;&lt;br /&gt;
    &lt;strong&gt;Be sure to change the "File" value to your exact path.&lt;br /&gt;
    Note the &lt;font color="#ff0000"&gt;double&lt;/font&gt; backslashes and the full physical file path.&lt;/strong&gt; I was not able to get relative file paths to work at WH4L.&lt;/font&gt;&lt;/font&gt; &lt;/li&gt;
    &lt;li&gt;&lt;font face="Arial"&gt;Near the bottom of the Log4Net.config file, in the &amp;lt;root&amp;gt; element, add the following line:&lt;br /&gt;
    &lt;font face="Arial"&gt;&lt;strong&gt;&amp;lt;appender-ref ref="FileAppender" /&amp;gt;&lt;/strong&gt;&lt;/font&gt;&lt;/font&gt; &lt;/li&gt;
    &lt;li&gt;&lt;font face="Arial"&gt;Also in the root element, change the level line so it reads like this:&lt;br /&gt;
    &lt;font face="Arial"&gt;&amp;lt;level value="&lt;strong&gt;DEBUG&lt;/strong&gt;" /&amp;gt;&lt;/font&gt;&lt;/font&gt; &lt;/li&gt;
    &lt;li&gt;&lt;font face="Arial"&gt;After you edit Log4Net.config and upload the edited file to your web server (overwriting your original file), you can restart your blog. I usually restart it by editing web.config. I just make a change in a comment and save web.config and the blog will restart.&lt;/font&gt; &lt;/li&gt;
    &lt;li&gt;&lt;font face="Arial"&gt;When Subtext restarts, it will write the following message in the log file (which you have named similarly to \Logs\your_blog.log): &lt;font size="2"&gt;&lt;strong&gt;Application_Start - This is not a malfunction&lt;/strong&gt;.&lt;/font&gt;&lt;/font&gt; &lt;/li&gt;
    &lt;li&gt;&lt;font face="Arial"&gt;&lt;font size="2"&gt;Once you see the \Logs\your_blog.log file has been created and Subtext is logging to it, you can begin solving whatever other technical issues you might be facing. As I said, having access to an error log is often the very first troubleshooting step.&lt;/font&gt;&lt;/font&gt; &lt;/li&gt;
    &lt;li&gt;If you cannot find the log file on the file system, or if you find it but it is zero bytes, then something in your configuration is still not correct. Keep reviewing the steps until you get Subtext and log4net to write a log file. When everything is working, the log file should at least contain the Application_Start message cited above.&lt;/li&gt;
    &lt;li&gt;For more information on log4net, see the &lt;a title="Opens in new window" target="_blank" href="http://logging.apache.org/log4net/"&gt;project site&lt;/a&gt;. You can find configuration examples and full documentation  there. And if you really need &lt;strong&gt;detailed info on log4net&lt;/strong&gt;, the &lt;a title="Opens in new window" target="_blank" href="http://mail-archives.apache.org/mod_mbox/logging-log4net-dev/"&gt;&lt;strong&gt;mailing list archives&lt;/strong&gt;&lt;/a&gt; are a great resource!&lt;/li&gt;
    &lt;li&gt;&lt;font face="Arial"&gt;&lt;font size="2"&gt;&lt;/font&gt;Another thing you might want to do is set up the logging to send you emails when errors occur. The steps are the same as above, but instead of working with the FileAppender in log4net, you work with the SmtpAppender. When the SmtpAppender is properly configued, Subtext will send you an email whenever any errors occur. Below are my SmtpAppender settings from Log4Net.config:&lt;/font&gt; &lt;/li&gt;
&lt;/ol&gt;
&lt;font face="Arial"&gt;
&lt;p&gt;&lt;font color="#800000" size="2"&gt;&amp;lt;log4net&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&amp;gt;&lt;br /&gt;
&amp;lt;&lt;/font&gt;&lt;font color="#800000" size="2"&gt;appender&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt; &lt;/font&gt;&lt;font color="#ff0000" size="2"&gt;name&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;=&lt;/font&gt;&lt;font size="2"&gt;"&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;SmtpAppender&lt;/font&gt;&lt;font size="2"&gt;"&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt; &lt;/font&gt;&lt;font color="#ff0000" size="2"&gt;type&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;=&lt;/font&gt;&lt;font size="2"&gt;"&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;log4net.Appender.SMTPAppender&lt;/font&gt;&lt;font size="2"&gt;"&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&amp;gt;&lt;br /&gt;
  &amp;lt;&lt;/font&gt;&lt;font color="#800000" size="2"&gt;param&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt; &lt;/font&gt;&lt;font color="#ff0000" size="2"&gt;name&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;=&lt;/font&gt;&lt;font size="2"&gt;"&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;To&lt;/font&gt;&lt;font size="2"&gt;"&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt; &lt;/font&gt;&lt;font color="#ff0000" size="2"&gt;value&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;=&lt;/font&gt;&lt;font size="2"&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;a href="mailto:value=your_name@domain.net"&gt;your_name@domain.net&lt;/a&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt; /&amp;gt;&lt;br /&gt;
  &amp;lt;&lt;/font&gt;&lt;font color="#800000" size="2"&gt;param&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt; &lt;/font&gt;&lt;font color="#ff0000" size="2"&gt;name&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;=&lt;/font&gt;&lt;font size="2"&gt;"&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;From&lt;/font&gt;&lt;font size="2"&gt;"&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt; &lt;/font&gt;&lt;font color="#ff0000" size="2"&gt;value&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;=&lt;/font&gt;&lt;font size="2"&gt;"&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;&lt;a href="mailto:value=your_name@domain.net"&gt;your_name@domain.net&lt;/a&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;"&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt; /&amp;gt;&lt;br /&gt;
  &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&amp;lt;&lt;/font&gt;&lt;font color="#800000" size="2"&gt;param&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt; &lt;/font&gt;&lt;font color="#ff0000" size="2"&gt;name&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;=&lt;/font&gt;&lt;font size="2"&gt;"&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;Subject&lt;/font&gt;&lt;font size="2"&gt;"&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt; &lt;/font&gt;&lt;font color="#ff0000" size="2"&gt;value&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;=&lt;/font&gt;&lt;font size="2"&gt;"&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;Error occurred in Blog at WH4L&lt;/font&gt;&lt;font size="2"&gt;"&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt; /&amp;gt;&lt;br /&gt;
  &amp;lt;&lt;/font&gt;&lt;font color="#800000" size="2"&gt;param&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt; &lt;/font&gt;&lt;font color="#ff0000" size="2"&gt;name&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;=&lt;/font&gt;&lt;font size="2"&gt;"&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;SMTPHost&lt;/font&gt;&lt;font size="2"&gt;"&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt; &lt;/font&gt;&lt;font color="#ff0000" size="2"&gt;value&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;=&lt;/font&gt;&lt;font size="2"&gt;"&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;smtp.domain.net&lt;/font&gt;&lt;font size="2"&gt;"&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt; /&amp;gt;&lt;br /&gt;
  &amp;lt;&lt;/font&gt;&lt;font color="#800000" size="2"&gt;param&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt; &lt;/font&gt;&lt;font color="#ff0000" size="2"&gt;name&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;=&lt;/font&gt;&lt;font size="2"&gt;"&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;BufferSize&lt;/font&gt;&lt;font size="2"&gt;"&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt; &lt;/font&gt;&lt;font color="#ff0000" size="2"&gt;value&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;=&lt;/font&gt;&lt;font size="2"&gt;"&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;1&lt;/font&gt;&lt;font size="2"&gt;"&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt; /&amp;gt;&lt;br /&gt;
  &amp;lt;&lt;/font&gt;&lt;font color="#800000" size="2"&gt;param&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt; &lt;/font&gt;&lt;font color="#ff0000" size="2"&gt;name&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;=&lt;/font&gt;&lt;font size="2"&gt;"&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;Lossy&lt;/font&gt;&lt;font size="2"&gt;"&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt; &lt;/font&gt;&lt;font color="#ff0000" size="2"&gt;value&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;=&lt;/font&gt;&lt;font size="2"&gt;"&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;false&lt;/font&gt;&lt;font size="2"&gt;"&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt; /&amp;gt;&lt;br /&gt;
  &amp;lt;&lt;/font&gt;&lt;font color="#800000" size="2"&gt;param&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt; &lt;/font&gt;&lt;font color="#ff0000" size="2"&gt;name&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;=&lt;/font&gt;&lt;font size="2"&gt;"&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;Threshold&lt;/font&gt;&lt;font size="2"&gt;"&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt; &lt;/font&gt;&lt;font color="#ff0000" size="2"&gt;value&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;=&lt;/font&gt;&lt;font size="2"&gt;"&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;DEBUG&lt;/font&gt;&lt;font size="2"&gt;"&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;/&amp;gt;&lt;br /&gt;
  &amp;lt;&lt;/font&gt;&lt;font color="#800000" size="2"&gt;layout&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt; &lt;/font&gt;&lt;font color="#ff0000" size="2"&gt;type&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;=&lt;/font&gt;&lt;font size="2"&gt;"&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;log4net.Layout.PatternLayout&lt;/font&gt;&lt;font size="2"&gt;"&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&amp;gt;&lt;br /&gt;
    &amp;lt;&lt;/font&gt;&lt;font color="#800000" size="2"&gt;conversionPattern&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt; &lt;/font&gt;&lt;font color="#ff0000" size="2"&gt;value&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;=&lt;/font&gt;&lt;font size="2"&gt;"&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;%-5p %n%d{ISO8601} [ThreadId: %t] Class:%c{1} Method:%M %nMESSAGE:%n%m%n%n&lt;/font&gt;&lt;font size="2"&gt;"&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt; /&amp;gt;&lt;br /&gt;
  &amp;lt;/&lt;/font&gt;&lt;font color="#800000" size="2"&gt;layout&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&amp;gt;&lt;br /&gt;
&amp;lt;/&lt;/font&gt;&lt;font color="#800000" size="2"&gt;appender&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&amp;gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font color="#0000ff" size="2"&gt;snip...&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&amp;lt;&lt;font color="#800000" size="2"&gt;root&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&amp;gt;&lt;br /&gt;
    &amp;lt;!--&lt;/font&gt;&lt;font color="#008000" size="2"&gt; Set this to "WARN" after troubleshooting is complete &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;--&amp;gt;&lt;br /&gt;
    &amp;lt;&lt;/font&gt;&lt;font color="#800000" size="2"&gt;level&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt; &lt;/font&gt;&lt;font color="#ff0000" size="2"&gt;value&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;=&lt;/font&gt;&lt;font size="2"&gt;"&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;DEBUG&lt;/font&gt;&lt;font size="2"&gt;"&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt; /&amp;gt;&lt;br /&gt;
    &amp;lt;&lt;/font&gt;&lt;font color="#800000" size="2"&gt;appender-ref&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt; &lt;/font&gt;&lt;font color="#ff0000" size="2"&gt;ref&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;=&lt;/font&gt;&lt;font size="2"&gt;"&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;AdoNetAppender&lt;/font&gt;&lt;font size="2"&gt;"&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt; /&amp;gt;&lt;br /&gt;
    &amp;lt;&lt;/font&gt;&lt;font color="#800000" size="2"&gt;appender-ref&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt; &lt;/font&gt;&lt;font color="#ff0000" size="2"&gt;ref&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;=&lt;/font&gt;&lt;font size="2"&gt;"&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;SmtpAppender&lt;/font&gt;&lt;font size="2"&gt;"&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt; /&amp;gt;&lt;br /&gt;
    &amp;lt;&lt;/font&gt;&lt;font color="#800000" size="2"&gt;appender-ref&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt; &lt;/font&gt;&lt;font color="#ff0000" size="2"&gt;ref&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;=&lt;/font&gt;&lt;font size="2"&gt;"&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;FileAppender&lt;/font&gt;&lt;font size="2"&gt;"&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt; /&amp;gt;&lt;br /&gt;
  &amp;lt;/&lt;/font&gt;&lt;font color="#800000" size="2"&gt;root&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&amp;gt;&lt;br /&gt;
&amp;lt;/&lt;/font&gt;&lt;font color="#800000" size="2"&gt;log4net&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&amp;gt;&lt;/font&gt;&lt;br /&gt;
&lt;/p&gt;
&lt;/font&gt;&lt;img src="http://blog-howto.com/aggbug/220.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Dave's Tech Shop</dc:creator>
            <guid>http://blog-howto.com/archive/2006/09/15/UsingLog4NetAtWH4L.aspx</guid>
            <pubDate>Fri, 15 Sep 2006 18:51:59 GMT</pubDate>
            <comments>http://blog-howto.com/archive/2006/09/15/UsingLog4NetAtWH4L.aspx#feedback</comments>
            <slash:comments>1</slash:comments>
            <wfw:commentRss>http://blog-howto.com/comments/commentRss/220.aspx</wfw:commentRss>
            <trackback:ping>http://blog-howto.com/services/trackbacks/220.aspx</trackback:ping>
        </item>
    </channel>
</rss>