Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

We have a typical setup in IIS for our webapp with virtual dirs for different projects:

  • www.webapp.com (Website)
    • project1 (virtual dir)
    • project2 (virtual dir)
    • project3 (virtual dir)

The webapp has login.aspx as a default document, as do all the virtual dirs. Now, I need a different default document (index.aspx) only for the www.webapp.com website. The virtual dirs will continue to use login.aspx and only that.

EDIT: All virtual dirs point to the same physical directory. If I change the default document for www.webapp.com, it is also changed for all underlying virtual dirs.

This used to be easy in IIS 6, but in IIS 7.5 I am unsuccessful to implement this.

I think I need to alter applicationhost.config by adding location tags, but I have no clue how to start. Can someone point me in the right direction?

Thanks! Stijn

share|improve this question
add comment

3 Answers

To do this you need to modify the the ApplicationHost.config file. The location of the file is currently in the %windir%\system32\inetsrv\config directory.

The Location section towards the end of the document needs to be modified accordingly depending on your app default documents. for eg -

<location path="Default Web Site/App">
    <system.webServer>
        <defaultDocument enabled="true">
            <files>
                <clear />
                <add value="Login.aspx" />
            </files>
        </defaultDocument>
        <security>
            <authentication>
                <anonymousAuthentication enabled="false" />
            </authentication>
        </security>
    </system.webServer>
</location>


<location path="Default Web Site/App/VApp2">
    <system.webServer>
        <defaultDocument enabled="true">
            <files>
                <clear />
                <add value="LoginPage2.aspx" />
            </files>
        </defaultDocument>
        <security>
            <authentication>
                <anonymousAuthentication enabled="false" />
            </authentication>
        </security>
    </system.webServer>
</location>
share|improve this answer
add comment

Yeah, the easiest (read: cheat-i-est) way of configuring this is to:

Open Feature Delegation, and disable delegation of the Default Document module (or make it read-only) for the site.

With that done, the GUI will create <location> tags for you at any level lower than the Delegation setting you just configured.

share|improve this answer
add comment

Maybe I didn't understand your problem, but it seems trivial to me.

Open the Internet Information Services Manager, select the virtual directory (double click). In the IIS section, open "Default Document" and set your default document (or remove some).

Repeat the procedure for all of your virtual directories.

UPDATE:

Question: Do (some of) your virtual directories point to the same physical directory? IIS saves the information in web.config files in the physical directory. That may be your problem.

Workaround: create some logic that redirects the requests of the virtual directories. Or create a copy of your physical directory so that the web.config files can be set individually.

share|improve this answer
    
indeed, I forgot to mention that they all point at the same physical directory. I'll update the post - Thanks! –  Stijn Van Loo Feb 5 '11 at 10:25
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.