Iis 7 ASPError对象没有';“我的自定义错误页上不包含任何数据”

Iis 7 ASPError对象没有';“我的自定义错误页上不包含任何数据”,iis-7,asp-classic,vbscript,Iis 7,Asp Classic,Vbscript,我的web.config中有以下内容 <httpErrors errorMode="Custom"> <remove statusCode="500" subStatusCode="-1" /> <error statusCode="500" prefixLanguageFilePath="" path="/error.asp" r

我的web.config中有以下内容

<httpErrors errorMode="Custom">
    <remove statusCode="500" subStatusCode="-1" />
    <error statusCode="500" prefixLanguageFilePath="" path="/error.asp" responseMode="ExecuteURL" />
</httpErrors>

更新 根据Joel在评论中链接到的线程,我已将我的web.config更新为以下内容:

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

不会给我
GetLastError
返回的Asperor对象中的数据

现在的问题是,我从生成错误的页面开始获取HTML,然后页面的其余部分是
error.asp
中的HTML


我真的希望它重定向到
error.asp
,但将web.config更改为
responseMode=“redirect”
似乎不起作用。

以下是对我有效的解决方案

按如下方式设置web.config

<httpErrors errorMode="Custom">
    <remove statusCode="500" subStatusCode="100" />
    <error statusCode="500" subStatusCode="100" prefixLanguageFilePath="" path="/error.asp" responseMode="ExecuteURL" />
</httpErrors>
<%@ Language=VBScript %>
<% 
    Option Explicit
    On Error Resume Next
    Response.Clear
    Dim objError, MessageBody
    Set objError = Server.GetLastError()

    Response.Write objError.ASPCode & "<br />"
    Response.Write objError.Number & "<br />"
    Response.Write objError.Description & "<br />"
%>

一个简单的错误。asp可能如下所示:

<httpErrors errorMode="Custom">
    <remove statusCode="500" subStatusCode="100" />
    <error statusCode="500" subStatusCode="100" prefixLanguageFilePath="" path="/error.asp" responseMode="ExecuteURL" />
</httpErrors>
<%@ Language=VBScript %>
<% 
    Option Explicit
    On Error Resume Next
    Response.Clear
    Dim objError, MessageBody
    Set objError = Server.GetLastError()

    Response.Write objError.ASPCode & "<br />"
    Response.Write objError.Number & "<br />"
    Response.Write objError.Description & "<br />"
%>

我的问题的关键似乎是在出现错误时执行
下一步恢复
响应。清除

我在Microsoft知识库文章(Q224070)中找到了解决方案

现在的问题是,我从一开始就得到了HTML 生成错误的页面,则页面的其余部分为 来自error.asp的HTML

放置

Response.Clear

在自定义错误页面中

此线程是否有帮助?这无疑给了我一个起点。我用更多的信息更新了这个问题。对我来说,只有当我在服务器的根级别添加了500.100处理程序时,这才有效。(我有IIS 7.5)是的,绝对有必要添加
subStatusCode=“100”
,以便从自定义错误页面上的
Server.GetLastError()
接收
ASPError
对象。您好。我设置了上述设置,但现在我遇到了
errorMode
的问题。即使我将其设置为
DetailedLocalOnly
,我也总能在本地计算机上看到我的自定义错误页面。