如何处理 web.config 文件中的 403.9 HTTP 错误?
你们中有人知道如何处理 web.config 文件中的 XXX.X IIS HTTP 错误吗?我尝试执行以下操作:
<customErrors mode="On" defaultRedirect="error.aspx">
<error statusCode="403" redirect="error403.aspx" />
...
<!--NOTE: The following does not work-->
<error statusCode="403.9" redirect="error403.9.aspx" />
<!--ENDNOTE-->
...
<error statusCode="404" redirect="error404.aspx" />
...
</customErrors>
但显然这不起作用,因为 web.config 文件需要一个整数作为 statusCode 值。
上下文:WinServer 2003 - ASP.NET 3.5
Do anyone of you know how to handle XXX.X IIS HTTP errors in a web.config file? I tried doing the following:
<customErrors mode="On" defaultRedirect="error.aspx">
<error statusCode="403" redirect="error403.aspx" />
...
<!--NOTE: The following does not work-->
<error statusCode="403.9" redirect="error403.9.aspx" />
<!--ENDNOTE-->
...
<error statusCode="404" redirect="error404.aspx" />
...
</customErrors>
But obviously that didn't worked, because the web.config file expects an integer as the statusCode value.
CONTEXT: WinServer 2003 - ASP.NET 3.5
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
无论如何,403.9 不会被过滤到 .Net。 403.9 的全部意义在于 Web 服务器已经过载并且无法处理请求。
因此,对于这个特定的例子,这是行不通的。
为了进一步澄清,其中一些代码(如 401 和 403)是 IIS 代码,只能在该级别处理。因此,如果您想要 403.9 特定的内容,则必须编辑 IIS 配置来告诉它要做什么。
A 403.9 isn't going to be filtered down to .Net anyway. The whole point of a 403.9 is to say that the web server is already overloaded and it can't handle the request.
So, for this particular example, that won't work.
To further clarify, some of those codes (like 401 and 403) are IIS codes and can only be handled at that level. So, if you want something specific for 403.9, you'll have to edit the IIS configuration to tell it what to do.