Question

I have very strange problem. I'm using IIS 7.0 Integrated mode for my application. (pool is ASP 2.0 integrated)

It's working fine when i type www.xyz.com/MainPage.aspx. But when i used simple www.xyz.com then its not working.

I always get this error

The resource cannot be found. 
Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable.  Please review the following URL and make sure that it is spelled correctly. 

Requested URL: /intranet/default.aspx

I have mapped default document to MainPage.aspx still its not working... I don't have default.aspx page in root. only Mainpage.aspx and I can't change it...

my web.config looks like this (only part of it :):

<configuration>
   <system.webServer>
    <defaultDocument>
        <files>
            <clear />
            <add value="MainPage.aspx" />
        </files>
    </defaultDocument>
   </system.webServer>
</configuration> 
Was it helpful?

Solution

Check you web.config and make sure the default.aspx is not listed as one the default pages. Recycle the app pool and restart IIS.

<system.webServer>
    <defaultDocument>
        <files>
            <remove value="Default.htm"/>
            <remove value="Default.asp"/>
            <remove value="index.htm"/>
            <remove value="index.html"/>
            <remove value="default.aspx"/>
            <remove value="iisstart.htm"/>
            <add value="MainPage.aspx"/>
        </files>
    </defaultDocument>

OTHER TIPS

You need to add MainPage.aspx as default page through IIS's document facility. You may also add a default document with IIS7 web.config.

<configuration>
   <system.webServer>
    <defaultDocument>
        <files>
            <add value="MainPage.aspx" />
        </files>
    </defaultDocument>
   </system.webServer>
</configuration> 

I think this setting is locked in IIS7 on applicationHost.config level. You have to change the root config gile or use IIS Administration API do complete this task.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top