带有子状态的错误代码的"IIS 7.0自定义错误"页面 [英] IIS 7.0 Custom Error page for error code with a substatus
问题描述
有人使用以下方法成功创建了自定义错误"页面吗?
Has anybody successfully created a Custom error page using:
- IIS 7.0 GUI
- 子状态错误代码(例如404.13).
- 使用在此站点上执行网址"(而不是静态文件或 重定向选项)
- .asp错误页面
- The IIS 7.0 GUI
- a substatus error code (e.g. 404.13).
- using "Execute a Url on this site" (as opposed to the static File or Redirect options)
- an .asp error page
我能够获取显示自定义404.13错误消息的应用程序(这是一个传统的经典.asp应用程序)的唯一方法是对静态文件(.htm)使用重定向选项,或者对静态文件使用文件系统中带有htm文件的文件选项.
The only ways I have been able to get my application, which is a legacy classic .asp app, to display a custom 404.13 error message is to either use the redirect option with a static file (.htm) or use the static file option with an htm file from the file system.
次要问题:
IIS 7是否有针对子状态错误代码的自定义错误页面的限制?
Is there some restriction is IIS 7 to custom error pages for substatus error codes?
此外,出于安全考虑,是否建议返回子状态代码?
Also, is it ever recommended to return a substatus code because of security concerns?
推荐答案
在<system.webServer>
的<httpErrors>
元素中,您可以指定subStatusCode
属性:
In the <httpErrors>
element of <system.webServer>
you can specify a subStatusCode
attribute: http://www.iis.net/ConfigReference/system.webServer/httpErrors/error
但是,ASP.NET配置元素(<system.web>
的子级不支持子状态代码.
However the ASP.NET configuration elements (children of <system.web>
do not support sub-status codes.
这篇关于带有子状态的错误代码的"IIS 7.0自定义错误"页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!