Saturday, February 11, 2006
Posted on Saturday, February 11, 2006 10:39:55 AM (Mountain Standard Time, UTC-07:00)  Comments [0] | 
Categories: .NET | ASP.NET | dasBlog
Just a quick note on some issues I ran into getting dasBlog running in a subfolder under an ASP.NET 2.0 app that uses membership, roles , master pages and themes...

The first step to getting dasBlog running under a .NET 2.0 is to make the suggested changes in your web.config. Search this file for "2.0" and make those changes. In many cases, this may be all you need to do.

Membership & Role Providers
On my new site, I'm using the 2.0 membership and role capabilities. Since I'm trying to keep the site very lightweight, I'm using some read-only, XML based providers that I got from MSDN.

Links:
Read-Only XML Membership Provider,
Read-Only XMl Role Provider

These providers are setup in the web.config of the main application:

web.config for main application
<membership
  defaultProvider="AspNetReadOnlyXmlRoleProvider">
 <providers>
  <add name="AspNetReadOnlyXmlMembershipProvider"
     type="ReadOnlyXmlMembershipProvider, CustomProviders"
    description="Read-only XML membership provider"
      xmlFileName="~/App_Data/theUsers.xml"/>
  </providers>
</membership >
   similar section for the roles...


Since the xmlFileName is an app relative path, the file can not be found when running in the /blog subfolder. Not sure if this is the "best" way to get past this issue, since I could not find another way to disable the membership provider, I simply added this into the web.config in the /blog folder, and cleared the providers...

web.config for dasBlog
<membership defaultProvider="none">
 <providers>
   <clear />
  </providers>
</membership >


The Roles were much easier - I just set the enabled property to false in the dasBlog web.config...
web.config for dasBlog
<roleManager enabled="false" />


Of course this means that you have to log into the blog separately from the main site, but I can live with that for now.
Themes
As I mentioned, the main site uses themes. While struggling with themes, I had specified the theme this up in the <pages tag in the web.config, but when I hit dasBlog, ASP.NET would throw an error saying it could not find the theme ( another app relative path thing). I was able to get it working by simply removing the theme element from the pages tag. This worked for me because I'm also specifying the theme in the master page. If you are applying a theme directly to your pages without a master page, this could be a problem.
At this point, it's all working on my local machine, but I still have to upload it to my host (webhost4life) and see what happens there!
Comments are closed.