如何在asp.net中设置自定义错误页面 [英] how to set custom error pages in asp.net
本文介绍了如何在asp.net中设置自定义错误页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
< customerrors mode =打开" defaultredirect ="NotFound.aspx">
<错误statuscode ="404" redirect ="NotFound.aspx">
每当我的Web应用程序在不同的页面上出现错误时,都会显示默认的自定义错误页面架子,我在web.config文件中使用了上面的编码,但是当发生错误时notfound.aspx页面没有打开
<customerrors mode="On" defaultredirect="NotFound.aspx">
<error statuscode="404" redirect="NotFound.aspx">
when ever my web applicaitons getting error on different pages the default custom error pages shold show., i used above coding in web.config file but the notfound.aspx page not opening when error occurs
推荐答案
在web.config
文件中定义以下内容
Define following inweb.config
file
<customerrors defaultredirect="~/******.aspx" mode="On"><br />
<error statuscode="500" redirect="~/*****.aspx" /><br />
<error statuscode="404" redirect="~/*****.aspx" /><br />
</customerrors><br />
[更新]
谢谢
Ashish
[updated]
Thanks
Ashish
尝试以下任何一种方法:
显示自定义错误页面(C#)
ASP.NET自定义错误页面
ASP.NET中的自定义错误页面
Try any of the following:
Displaying a Custom Error Page (C#)
ASP.NET Custom Error Pages
Custom Error Pages in ASP.NET
请参阅下面的链接以获取有关CustomErrors
的详细信息:
ASP.NET中的自定义错误 [ MSDN:customErrors元素(ASP.NET设置架构) [ ASP.NET customErrors [ ^ ]
如何使用Visual C#.NET在ASP.NET中创建自定义错误报告页面 [
Hi,
Refer the links below for detailed information aboutCustomErrors
:
Custom Errors in ASP.NET[^]
MSDN : customErrors Element (ASP.NET Settings Schema)[^]
ASP.NET customErrors[^]
How to create custom error reporting pages in ASP.NET by using Visual C# .NET[^]
All the best.
--Amit
这篇关于如何在asp.net中设置自定义错误页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文