문제

I have a clean install of Windows Server 2008 with IIS7. There I installed "Classic ASP" and the changed the debugging option "Send Errors To Browser" to True.

1.

I created a directory with 2 files:

-- C:\inetpub\wwwroot\stadtbibliothek
 - index.asp -> <% Response.Write "Hello World" %>
 - 500-100.asp -> <% Response.Write "Error" %>

I konverted the directory to an application and assigned a application pool i created (.net version: no managed code, pipelinecode: classic).

Then I tested the page from an remote client (http://svr-name.domain/stadtbibliothek/) and "Hello World" showed up.

2.

I added an error to the index.asp file and a web.config file to the "stadtbibliothek" folder (there is none in the root):

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <defaultDocument>
            <files>
                <add value="index.asp" />
            </files>
        </defaultDocument>
                <httpErrors>
                    <remove statusCode="500" subStatusCode="100" />
                    <error statusCode="500" subStatusCode="100" prefixLanguageFilePath="" path="/error.asp" responseMode="ExecuteURL" />
                </httpErrors>
    </system.webServer>
</configuration>

Solution:

Turned out I just needed to include the folder name to the path:

<error statusCode="500" subStatusCode="100" prefixLanguageFilePath="" path="/stadtbibliothek/error.asp" responseMode="ExecuteURL" />

Thanks for your suggestions!

도움이 되었습니까?

해결책

From the documentation:

path: Required string attribute.

Specifies the file path or URL that is served in response to the HTTP error specified by the statusCode and subStatusCode attributes. If you choose the File response mode, you specify the path of the custom error page. If you choose the ExecuteURL response mode, the path has to be a server relative URL (for example, /404.htm). If you choose the Redirect response mode, you have to enter an absolute URL (for example, www.contoso.com/404.htm).

Try changing this line:

<error statusCode="500" subStatusCode="100" prefixLanguageFilePath="" path="/error.asp" responseMode="ExecuteURL" />

To this:

<error statusCode="500" subStatusCode="100" prefixLanguageFilePath="" path="/stadtbibliothek/error.asp" responseMode="ExecuteURL" />

다른 팁

I think you should the customErrors:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <system.webServer>
    *
    *
    *
  </system.webServer>
  <system.web>
     <customErrors mode="On"/>
  </system.web>
</configuration>
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top