2013-12-09 52 views
2

我有一个全新安装的Windows Server 2008与IIS7。我安装了“Classic ASP”,并将调试选项“将错误发送到浏览器”更改为True。经典ASP - 自定义错误页面

我创建一个目录,2个文件:

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

我konverted目录中的应用程序并为其分配一个应用程序池,我创建(.NET版本:无托管代码, pipelinecode:classic)。

然后我测试了远程客户端的页面(http://svr-name.domain/stadtbibliothek/)和“Hello World”出现。

2.

我添加一个错误给的index.asp文件和一个web.config文件以 “stadtbibliothek” 文件夹(有没有在根):

<?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> 

解决方案:

原来我只是需要包括文件夹名,路径:

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

感谢您的建议!

回答

1

documentation

路径:必需的字符串属性。

指定为响应由statusCode和subStatusCode属性指定的HTTP 错误而提供的文件路径或URL。如果您选择文件响应模式 ,则可以指定自定义错误页面的路径 。如果选择ExecuteURL响应模式,则的路径具有 为服务器相对URL(例如,/404.htm)。如果您选择 重定向响应模式,则必须输入绝对URL(例如, 示例,www.contoso.com/404.htm)。

尝试修改此行:

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

要这样:

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

我想你应该在的customErrors:

<?xml version="1.0" encoding="UTF-8"?> 
<configuration> 
    <system.webServer> 
    * 
    * 
    * 
    </system.webServer> 
    <system.web> 
    <customErrors mode="On"/> 
    </system.web> 
</configuration>