2

I have an IIS website running an ASP.NET site but it has multiple applications running under it (a virtual directory with separate app pools basically).

Well - I need two separate applications which point to the same root folder director but I want the apps to have separate default documents. The reason is because this is how it is configured in production and this is on my development box.

The problem is that IIS keeps giving me the SAME default document for both apps (which are separate virtual paths and separate app pools just same physical location). How can I overcome this or can I not in IIS7?

I am going to be re-writing the whole thing and it will not be done this way in the furture...but until then I need to fix some bugs and want a local dev environment. Help!

Paul C Huff
  • 83
  • 1
  • 6
  • Your Default Document settings in IIS can be set per site and also per subdirectory. You need to open up your IIS managment tool and edit the documents there. – Nick Bork Apr 06 '12 at 15:34
  • Nick - the problem is that these are both under the same directory. So they are using the same web.config created by IIS (its actually a classic asp site). I tried adding a location tag with the virtual path but that was a no go. – Paul C Huff Apr 06 '12 at 15:56
  • Are you talking about the default document list to be served (default.htm, default.html, default.asp, etc?). http://technet.microsoft.com/en-us/library/cc771439%28v=ws.10%29.aspx – Nick Bork Apr 06 '12 at 16:34
  • Unsure if this will help since I may have misunderstood your post. If you have 2 sub dirs/applications under the root, each of those applications/folders can have its own web.config. If your "root" is empty, it maybe easier to not have a web.config in it (or else you may need to override settings in the sub dirs). – EdSF Apr 08 '12 at 03:22

1 Answers1

3

In order to accomplish this and preserve the setup implemented in our sites I needed to add a location tag around the System.WebServer element in the root site web.config and specify the default document in there as follows where the path is the VirtualDirectory/Application name:

<location path="VirtualDirectoryName">
    <system.webServer>
        <defaultDocument>
            <files>
                <clear />
                <add value="Document.asp" />
            </files>
        </defaultDocument>
    </system.webServer>
</location>
<location path="VirtualDirectoryName2">
    <system.webServer>
        <defaultDocument>
            <files>
                <clear />
                <add value="AnotherDocument.asp" />
            </files>
        </defaultDocument>
    </system.webServer>
</location>
Paul C Huff
  • 83
  • 1
  • 6
  • Hi, is it possible to add defaultDocument as . When I tried this the j ans css are not working on the index page. How can we manage this by defaultDocument concept...? – felix Antony Mar 25 '13 at 12:18