开发者

asp Default document not working on IIS7

I have a classic asp application inside a .NET 4.0 application. I have set the default document to login.asp, but it does not automatically redirect to it. The entire application functions fine though and even displays the login.asp correctly if I browse to it.

The default document section in web.config is as below:

<defaultDocument>
    <files>
        <clear />
        <add value="login.asp" />
        <add value="index.html" />
        <add value="default.aspx" />
        <add value="Default.htm" />
        <add value="Default.asp" />
        <add value="index.htm" />
        <add value="iisstart.htm" />
    </files>
</defaultDocument>

I have looked at oth开发者_开发技巧er similar questions on this site but were not of much help.


I finally found the issue was because the asp application was assigned to an app pool in classic mode using .NET Framework 4.0.

Once I changed the app pool to use .NET Framework 2.0 (with managed pipeline in classic mode), the default document started to work too!


  1. Make sure you have Read/Write Feature Delegation enabled for Default Document:

    asp Default document not working on IIS7

  2. DefaultDocument does not redirect to the file (i.e. URL is not changed). It acts similar to Server.Transfer function — executes the file when root URL (http://sitename/) is requested. Probably, your login.asp executed but it has instructions to redirect logged-in users to a different page, or display the different content to them.

  3. Make sure the response is not cached. Clear cache and cookies and try again.


I had this problem today with a brand new asp.net site deployed to Azure. I tried messing with IIS and my web.config included

<defaultDocument enabled="true">
    <files>
        <clear />
        <add value="Index.html" />
    </files>
</defaultDocument>

Turns out my problem was that the File > New Project wizard uses .NET 4.5.2 by default, and that isn't fully supported yet in Azure. I recompiled using .NET 4.5 as the target and everything works now!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜