简体   繁体   中英

Problem when default page is MainPage.aspx not Default.aspx

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> 

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>

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM