社区
C#
帖子详情
customError问题?
绿皮车
2003-01-23 11:08:22
我在写catch{}语句中对Exception异常用throw 语句抛出,那在error.aspx页如何捕获抛出的信息?
谢谢!
...全文
71
2
打赏
收藏
customError问题?
我在写catch{}语句中对Exception异常用throw 语句抛出,那在error.aspx页如何捕获抛出的信息? 谢谢!
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
2 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
xzygod
2003-01-23
打赏
举报
回复
error.aspx一般都作自定义的错误信息,而不是把系统的错误信息给用户看,否则这个文件也就没有使用的意义了
juqiang
2003-01-23
打赏
举报
回复
修改你得global.asax.cs文件,在protected void Application_Error(Object sender, EventArgs e)中增加下列代码:
Exception ex = Server.GetLastError();
Application.Add("FQQ_ErrorInfo",ex);
然后在你的Error.aspx.cs中,修改page_load的代码,如下:
Response.Expires = 0;
Exception ex = (Exception)(Application.Get("FQQ_ErrorInfo"));
if(ex!=null)
{
string httpHead = Request.ServerVariables.Get("SERVER_NAME");
string errorFile = "";
for(int i=0;i<Request.QueryString.Count;i++)
{
string[] s = this.Request.QueryString.GetValues(i);
foreach(string str in s)
{
errorFile += str;
}
}
SourceFile.Text = "HTTP://"+httpHead+errorFile;
MsgLine.Text = ex.InnerException.Message;
CodeLine.Text = ex.InnerException.StackTrace;
}
Application.Remove("FQQ_ErrorInfo");
这是我的一段代码,后面的对于一些textbox的赋值,你一看名字就知道什么意思了。
asp.net mvc 3 配置全局异常处理 Web.config中设置
Custom
Error
Web.config中设置
Custom
Error
Custom
Error
定义自动处理异常的行为,如下所示: --> --> Mode的值可以是Off、On、RemoteOnly,不同的值定义研发阶段或产品发布后的行为。 Mode值的使用场景: On:开启自定义错误处理。 Off:关闭自定义错误处理,当发生异常时,就会看到ASP.NET的黄页信
Custom
Error
设置失效的
问题
遇到一个奇怪
问题
,在web.config中无论怎么设置
custom
Error
s,都不起作用,即使设置为<
custom
Error
s mode="Off">,显示的也是
custom
Error
s。 在网上搜索到“Why I am not able Turn Off
Custom
Error
s? ”,才知道原来是在machine.config中设置了<deploy...
An application
error
occurred on the server. The current
custom
error
settings for this application
在iis服务器的cmd下C:/WINDOWS/Microsoft.NET/Framework/v4.0.30319/aspnet_regiis -i -enable
Custom
Error
Handler while Validating XML against XSD Schema
In this example we create a
Custom
Error
Handler while Validating XML against XSD. We use the javax.xml.validation.Validator to check the XML document against the XSD schema. We can create a
custom
er...
C# 报An application
error
occurred on the server.
Description: An application
error
occurred on the server. The current
custom
error
settings for this application prevent the details of the application
error
from being viewed remotely (for security reasons). It could, however, be viewed by browsers runnin
C#
110,499
社区成员
642,566
社区内容
发帖
与我相关
我的任务
C#
.NET技术 C#
复制链接
扫一扫
分享
社区描述
.NET技术 C#
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
让您成为最强悍的C#开发者
试试用AI创作助手写篇文章吧
+ 用AI写文章