【问题标题】:Custom HTTP Errors in IIS 7IIS 7 中的自定义 HTTP 错误
【发布时间】:2011-04-26 18:44:59
【问题描述】:

我正在尝试处理我的网络应用程序中的 403 和 404 错误。我已阅读MS instructions 并在我的服务器上应用。 IIS7 管理器通过将我的 web.config 编辑为:

<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节点中添加这个配置&lt;customErrors mode="On" defaultRedirect="/mysite/error.aspx" /&gt;。

任何人都知道 a) 为什么 IIS7 只处理 aspx 和 b) 任何人都知道如何处理像 http://www.mysite/fictiousURLTest.html 这样的通用请求?

谢谢,比尔 N

【问题讨论】:

    标签: iis-7 custom-errors


    【解决方案1】:

    在这里查看我的回复:IIS7 and HTTP status code handling

    看来你可能需要设置

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-11-23
      • 1970-01-01
      • 2012-08-17
      • 2013-02-08
      • 2017-02-16
      • 1970-01-01
      相关资源
      最近更新 更多