IIS 7中自定义HTTP错误

4
我正在尝试处理我的Web应用程序中的403和404错误。我已经阅读了微软的说明并在我的服务器上应用了。通过编辑我的web.config,IIS7管理器有效地处理了这个问题:
<httpRedirect enabled="false" destination="/MySite" httpResponseStatus="Temporary" />
   <httpErrors>
      <remove statusCode="404" subStatusCode="-1" />
      <remove statusCode="403" subStatusCode="-1" />
      <error statusCode="403" prefixLanguageFilePath="" path="/mySite/Error.aspx" responseMode="ExecuteURL" />
       <error statusCode="404" prefixLanguageFilePath="" path="/mySite/Error.aspx" responseMode="ExecuteURL" />
   </httpErrors>

它可以处理像http://www.mysite/fictiousURL.aspx这样的请求,但无法处理http://www.mysite/fictiousURLTest.html。它似乎只能处理aspx请求。
我还尝试了http://www.15seconds.com/issue/030102.htm,通过在system.web节点中添加此配置<customErrors mode="On" defaultRedirect="/mysite/error.aspx" />
有人知道a)为什么IIS7只处理aspx,b)有人知道如何处理通用请求,例如http://www.mysite/fictiousURLTest.html吗?
谢谢,比尔N
1个回答

2

请参考我在这里给出的回答:IIS7和HTTP状态码处理

看起来您可能需要设置

  <system.webServer>
    <httpErrors existingResponse="PassThrough" />
  </system.webServer>

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接