DasBlog and the Web.Config Location Tag

Posted: 5/18/2008 4:02:55 PM

So you may or may not have noticed that I haven't posted anything for the past two months and that most of my links have been broken. Well, the reason being is that I run a small intranet application for a group I belonged to at Iowa State. When I moved the application over to discountasp.net the application was living in a subdirectory of my vonsharp.net domain, and in doing so I ran into all sorts of messy web.config problems.

Well, I think finally have solved all the issues and should be posting once or twice a week from here on out. But just incase you're interested here is how I resolved my issues.

In order to run a seperate web application in a subdirectory of your DasBlog directory you'll need to do the following:

1. In your DasBlog web.config, wrap all of the configuration tag's children in one single "location" tag, except for the configSections tag and the runtime tag. Your dasBlog web.config should look something like:

<configuration>
    <configSections> ... </configSections>
    <runtime> ... <runtime>
    <location path="" allowOverride="true">
       <newtelligence.ControlImages ... >
       ...
       <system.web ... >
       ...
    </location>
<configuration>
Note: DO NOT CHANGE THE PATH, LEAVE IT AS AN EMPTY STRING

2. Then in your new sub-directory web application's web.config you'll need to do the same thing, and leave the path string empty as long as your web.config is actually sitting in the sub directory. As I understand it, its possible to define this in your dasBlog's web config but I'd recommend against it.

Here is the tricky part. The location tag for the sub-directory application acts just like object inheritence. So your web application's web.config will inherit all of the same configuration from its parent directory. Since you probably don't want dasBlog running in your sub directory, you need to clear out it's http modules. So in your new web app's web config add the following markup to the httpModules section

<httpModules>
    <!-- gets rid of dasBlog Modules -->
    <remove name="UrlMapperModule"/>
    <remove name="TitleMapperModule"/>
    <remove name="ProfileMapperModule"/>
    <remove name="ControlImageModule"/>
    <remove name="CompressionModule"/>
    <remove name="IPBlackList"/>
</httpModules>
Hope this helps anyone who is going through the same pain that I had.



Tags: Tips and Tricks