web.config问题中的客户错误 [英] Customerrors in web.config question

查看:65
本文介绍了web.config问题中的客户错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开设其他人设置的网站。他们有一个

web.config文件,其中包含一个指向错误处理的客户错误元素

到特殊的aspx页面。


< customErrors mode =" RemoteOnly" defaultRedirect =" /customerrors/500.aspx">

< error statusCode =" 404"重定向= QUOT; /customerrors/404.html" />

< / customErrors>


直接在服务器上运行页面时,如果发生错误

,它仍会重定向即使它不应该通过RemoteOnly来判断。设置。我还试图将模式设置为关闭。但这也不会改变

的行为。我能错过什么?我找了其他配置

文件,但没找到。任何人都有任何想法,为什么我不能关闭

错误处理,或者我可以找出发生了什么?

解决方案

您确定该网站在IIS中设置为应用程序

(或至少作为虚拟目录)吗?


customErrors模式仅在web.config

文件放在IIS应用程序的根目录

或IIS虚拟目录中时才有效。


customError设置仅适用于ASP.NET文件

(具有特定ASP.NET扩展名的文件,如aspx和asmx)。


如果用户请求您的Web服务器上不存在的.htm或.asp文件,即使您拥有404和404。在web.config中指定重定向

,IIS将根据IIS元数据库中定义的HTTP

错误设置重定向用户,而不是

.Web.config文件中的错误设置。


..asp和.htm文件不由ASP.NET管理。


ASP.NET Web.config文件设置适用于

应用程序的目录和任何子目录。


可以使用特定页面覆盖这些设置

Page指令的ErrorPage属性。


Juan T. Llibre

ASP.NET MVP

===========

" Ron Weldy" < RO ****** @ msn.com>在消息中写道

news:O


**************** @ TK2MSFTNGP14.phx.gbl ...

我正在开设一个其他人已设置的网站。它们有一个带有customerrors元素的web.config文件,该元素将错误处理指向特殊的aspx页面。

< customErrors mode =" RemoteOnly" defaultRedirect =" /customerrors/500.aspx">
< error statusCode =" 404"重定向= QUOT; /customerrors/404.html" />
< / customErrors>

当直接在服务器上运行页面时,它仍然会在发生错误时重定向,即使它不应该通过RemoteOnly来判断;设置。我还尝试将模式设置为关闭。但这并没有改变这种行为。我能错过什么?我找了其他配置文件,但没找到。任何人都有任何想法,为什么我不能关闭错误处理,或者我可以找出什么是



感谢。我假设web.config文件不控制

发生了什么,但我不知道在哪里看。我会查看你的建议。

这是重定向的脚本错误,我希望能够在调试时切换
,然后在完成后恢复。我认为已将

设置为应用程序,并且配置文件位于根目录中,但我确定
将确保。


此外,如果有人有一个很好的建议,在途中阅读

,这将有所帮助。我似乎很难找到关于IIS 6和ASP.NET中不同级别的错误处理的简明

描述

以及它们如何相互关联。

Juan T. Llibre <无*********** @ nowhere.com>在留言中写道

news:u3 ************** @ tk2msftngp13.phx.gbl ...

你确定网站在IIS中设置为应用程序
(或至少作为虚拟目录)?

customErrors模式仅在web.config
文件放在根目录下时才有效IIS应用程序
或IIS虚拟目录。

customError设置仅适用于ASP.NET文件
(具有特定ASP.NET扩展名的文件,如aspx和asmx如果用户请求您的Web服务器上不存在的.htm或.asp文件,即使您有404文件也是如此。在web.config中重定向指定
,IIS将根据IIS元数据库中定义的HTTP
错误设置重定向用户,而不是通过Web.config文件中的
错误设置重定向。 />
.asp和.htm文件不由ASP.NET管理。

ASP.NET Web.config文件设置适用于
应用程序的目录和任何子目录。

使用Page指令的ErrorPage属性可以覆盖特定页面的这些设置。

Juan T. Llibre
ASP .NET MVP
===========
Ron Weldy < RO ****** @ msn.com>在消息中写道
新闻:O


I am working on a website that someone else has set up. They have a
web.config file with a customerrors element that points the error handling
to a special aspx page.

<customErrors mode="RemoteOnly" defaultRedirect="/customerrors/500.aspx">
<error statusCode="404" redirect="/customerrors/404.html" />
</customErrors>

When running pages directly on the server it still redirects when a error
occurs, even though it should not judging by the "RemoteOnly" setting. I
have also tried just setting the mode to "Off" but that does not change the
behavior either. What could I be missing? I have looked for other config
file but have found none. Anybody got any ideas why I cannot turn off the
error handling, or where I can look to figure out what is going on?

解决方案

Are you sure the website is setup as an Application
( or at least as a virtual directory ) in IIS ?

customErrors mode will only work if the web.config
file is placed in the root directory of an IIS application
or in an IIS virtual directory.

The customError settings only apply to ASP.NET files
(files with specific ASP.NET extensions such as aspx and asmx).

If a user requests an .htm or .asp file that does not exist on
your Web server, even if you have the "404" redirect specified
in web.config, IIS will redirect the user based on the HTTP
error settings defined within the IIS metabase and not by the
error settings in the Web.config file.

..asp and .htm files are not managed by ASP.NET.

The ASP.NET Web.config file settings apply to the
application''s directory and any child directories.

These settings can be overridden for specific pages using
the ErrorPage attribute of the Page directive.

Juan T. Llibre
ASP.NET MVP
===========
"Ron Weldy" <ro******@msn.com> wrote in message
news:O


****************@TK2MSFTNGP14.phx.gbl...

I am working on a website that someone else has set up. They have a
web.config file with a customerrors element that points the error handling
to a special aspx page.

<customErrors mode="RemoteOnly" defaultRedirect="/customerrors/500.aspx">
<error statusCode="404" redirect="/customerrors/404.html" />
</customErrors>

When running pages directly on the server it still redirects when a error
occurs, even though it should not judging by the "RemoteOnly" setting. I
have also tried just setting the mode to "Off" but that does not change
the behavior either. What could I be missing? I have looked for other
config file but have found none. Anybody got any ideas why I cannot turn
off the error handling, or where I can look to figure out what is going
on?



Thanks. I am assuming that the web.config files are not controlling what is
happening but I didn''t know where to look. I''ll check into your suggestions.
It''s script errors that get redirected that I would like to be able to
switch when debugging and then restore after completion. I think this has
been set up as an application and that the config file is in the root, but I
will make sure.

Also, if anyone has a good recommendation on where to read up on the way
this works that would be helpful. I seem to have trouble finding a concise
description on the different levels of error handling in IIS 6 and ASP.NET
and how they interrelate.
"Juan T. Llibre" <no***********@nowhere.com> wrote in message
news:u3**************@tk2msftngp13.phx.gbl...

Are you sure the website is setup as an Application
( or at least as a virtual directory ) in IIS ?

customErrors mode will only work if the web.config
file is placed in the root directory of an IIS application
or in an IIS virtual directory.

The customError settings only apply to ASP.NET files
(files with specific ASP.NET extensions such as aspx and asmx).

If a user requests an .htm or .asp file that does not exist on
your Web server, even if you have the "404" redirect specified
in web.config, IIS will redirect the user based on the HTTP
error settings defined within the IIS metabase and not by the
error settings in the Web.config file.

.asp and .htm files are not managed by ASP.NET.

The ASP.NET Web.config file settings apply to the
application''s directory and any child directories.

These settings can be overridden for specific pages using
the ErrorPage attribute of the Page directive.

Juan T. Llibre
ASP.NET MVP
===========
"Ron Weldy" <ro******@msn.com> wrote in message
news:O


这篇关于web.config问题中的客户错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆