自定义错误不起作用 [英] Custom Error not working

查看:122
本文介绍了自定义错误不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

customError功能不起作用。我把它设置为

我的web.config文件中的帮助。


< customErrors defaultRedirect =" DsAppError.aspx" mode =" RemoteOnly" />


我在我网站的几个不同部分尝试过抛出一个假的异常

我总是到达页面上写着将我的web.config更改为上面的声明


the customError feature is not working. I have it setup as the help says in
my web.config file.

<customErrors defaultRedirect="DsAppError.aspx" mode="RemoteOnly"/>

I tried in a couple different parts of my site to throw a dummy exception
and I always get to the page that says change my web.config to the statement
above.

推荐答案

试试这个:


< customErrors mode =" Off" defaultRedirect =" DsAppError.aspx" />


m。


------------- -

尼克 < NI ** @ digitronics.com>在留言中写道

新闻:Pj **************** @ newsread2.news.pas.earthli nk.net ...
try this:

<customErrors mode="Off" defaultRedirect="DsAppError.aspx"/>

m.

--------------
"Nick" <ni**@digitronics.com> wrote in message
news:Pj****************@newsread2.news.pas.earthli nk.net...
customError功能无效。我已将其设置为我的web.config文件中的
帮助。

< customErrors defaultRedirect =" DsAppError.aspx" mode =" RemoteOnly" />

我尝试在我的网站的几个不同部分抛出虚假的异常
我总是到达改变我的web.config的页面到上面的
语句。
the customError feature is not working. I have it setup as the help says in my web.config file.

<customErrors defaultRedirect="DsAppError.aspx" mode="RemoteOnly"/>

I tried in a couple different parts of my site to throw a dummy exception
and I always get to the page that says change my web.config to the statement above.



此功能的文档是否有误?如果customError关闭,那么

根据文档,您会得到一个生成错误的页面和

堆栈跟踪,并且不会显示自定义错误页面。


我想要的是它的工作方式与remoteOnly相同。我想要开发或本地的错误和

堆栈跟踪信息。系统工作正常。

在RemoteOnly上我得到一个包含异常信息的生成页面。但是在任何其他机器上的

RemoteOnly我得到一条消息,说你可以用自定义消息替换这个

页面。好吧,我已经定义了,但我不知道为什么

它不起作用。如果我像你建议的那样将设置变为关闭,那么远程

用户会收到错误和堆栈跟踪信息,这不是我想要的。


Mohammad Samara ; <莫****** @ samara.fslife.co.uk>在消息中写道

新闻:uq ************** @ TK2MSFTNGP12.phx.gbl ...
Is the documentation on this feature wrong? If customError is off then
according to the documentation you get a page generated with the error and
stack trace and no custom error pages will be shown.

What I want is for it to work like it says for remoteOnly. I want error and
stack trace info on the development or "local" system and that works fine.
On RemoteOnly I get a generated page with exception information. But on
RemoteOnly on any other machine I get a message saying you can replace this
page with a custom message. Well I have defined that but I do not know why
it doesnt work. If I turn the setting to Off like you suggested then remote
users get error and stack trace information which is not what I want.

"Mohammad Samara" <mo******@samara.fslife.co.uk> wrote in message
news:uq**************@TK2MSFTNGP12.phx.gbl...
试试这个:

< customErrors mode =" Off" defaultRedirect =" DsAppError.aspx" />

m。

--------------

尼克 < NI ** @ digitronics.com>在消息中写道
新闻:Pj **************** @ newsread2.news.pas.earthli nk.net ...
try this:

<customErrors mode="Off" defaultRedirect="DsAppError.aspx"/>

m.

--------------
"Nick" <ni**@digitronics.com> wrote in message
news:Pj****************@newsread2.news.pas.earthli nk.net...
customError功能不起作用。我把它设置为帮助
the customError feature is not working. I have it setup as the help says
我的web.config文件中说
in


< customErrors defaultRedirect =" DsAppError.aspx" mode =" RemoteOnly" />

我尝试在我网站的几个不同部分投掷虚拟
my web.config file.

<customErrors defaultRedirect="DsAppError.aspx" mode="RemoteOnly"/>

I tried in a couple different parts of my site to throw a dummy



例外和我总是到达上面的页面,将我的web.config更改为上面的


exception and I always get to the page that says change my web.config to the


语句





嗨Nick,

感谢您使用Microsoft新闻组服务。根据您的描述,

您想要在ASP.NET Web应用程序中设置自定义错误页面

将在发生错误时为远程客户端用户显示。而你

设置customErrors element as:

< customErrors defaultRedirect =" DsAppError.aspx" web.config文件中的mode =" RemoteOnly" />

。但是,你发现这不起作用。我的

理解是否正确?如果有任何问题,请随时纠正我。


首先,我确定您的原始设置为< customErrors

defaultRedirect = ; DsAppError.aspx"模式= QUOT;仅限远程" />"是完全正确的。所以

我确实感到很陌生,因为它不起作用。您可以试试以下测试后的




1.更改mode = asOn并查看它是否在本地或远程客户端上显示自定义错误

页面(DsAppError.aspx)?


2.如果仍然无法工作,我想你可能会检查错误

页面(DsAppError.aspx),它是否可访问或者是否有什么东西

错误的错误页?例如,您可以尝试将

defaultRedirect页面设置为

defaultRedirect =" http://localhost/appname/DsAppError.aspx"指定

完整路径。


3.如果在上述步骤后仍然没有成功,你会尝试创建

另一个简单的Web应用程序并提供一个简单的错误页面并将

web.config设置为

"< customErrors defaultRedirect =" customerrorpagename" mode =" RemoteOnly" />"


此外,您可以尝试重新启动IIS服务器。或者检查服务器环境。

请试试前面的建议。如果您有任何疑问或需要

任何帮助,请随时在此处发布。


问候,


Steven Cheng

Microsoft在线支持


安全! www.microsoft.com/security

(此帖子按原样提供,不作任何保证,并且不授予

权利。)

Hi Nick,
Thank you for using Microsoft Newsgroup service. From your description,
you''re wanting to set a custom error page in an ASP.NET web application
which will be shown for the remote client user when error occurs. And you
set the "customErrors" element as :
<customErrors defaultRedirect="DsAppError.aspx" mode="RemoteOnly"/>
in the web.config file. However, you found this didn''t work. Is my
understanding correct? If anything wrong, please feel free to correct me.

Firstly, I''m sure your original setting as "<customErrors
defaultRedirect="DsAppError.aspx" mode="RemoteOnly"/>" is quite correct. So
I do feel abit strange as it doesn''t work. Would you please try out the
following tests:

1. change the "mode=" as "On" and see whether it display the custom error
page("DsAppError.aspx") both on local or remote client?

2. If still fails to work, I think you may have a check on the error
page("DsAppError.aspx"), is it accessable or if there is something
incorrect with the error page? For example, you can try setting the
defaultRedirect page as
defaultRedirect="http://localhost/appname/DsAppError.aspx" to specify the
full path.

3. If still with no success after the above steps, would you try creating
another simple web application and provide a simple error page and set the
web.config as
"<customErrors defaultRedirect="customerrorpagename" mode="RemoteOnly"/>"

Also, you may try rebooting the IIS server. Or check the server enviroment.
Please try out the preceding suggestion. If you have any quesions or need
any help, please feel free to post here.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)


这篇关于自定义错误不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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