ASP.NET 记录页面错误及自定义错误页
来源:互联网 发布:人工智能的未来txt 编辑:程序博客网 时间:2024/06/10 00:24
protected override void OnError(EventArgs e)
{
// At this point we have information about the error
HttpContext ctx = HttpContext.Current;
Exception exception = ctx.Server.GetLastError();
string errorInfo = "错误URL: " + ctx.Request.Url.ToString() + "/n源: " + exception.Source + "/n消息Message: " + exception.Message + "/n堆栈: " + exception.StackTrace;
//ctx.Response.Write(errorInfo);
// --------------------------------------------------
// To let the page finish running we clear the error
// --------------------------------------------------
//ctx.Server.ClearError();
//base.OnError(e);
string LogName = "MyWebError";
if (!System.Diagnostics.EventLog.SourceExists(LogName))
{
System.Diagnostics.EventLog.CreateEventSource(LogName, "App");
}
System.Diagnostics.EventLog el = new System.Diagnostics.EventLog();
el.Source = LogName;
el.WriteEntry(errorInfo, System.Diagnostics.EventLogEntryType.Error);
}
web.config 上修改友好错误页 <customErrors mode="On" defaultRedirect="MyErrorPage.aspx">
</customErrors>
- ASP.NET 记录页面错误及自定义错误页
- ASP.NET自定义错误页面
- ASP.NET自定义错误页面
- ASP.NET自定义错误页面
- ASP.NET自定义错误页面
- asp.net自定义错误页面
- ASP.NET自定义错误页面
- ASP.NET自定义错误页面
- ASP.NET自定义错误页面
- ASP.NET自定义错误页面
- asp.net自定义错误页面
- ASP.NET自定义错误页面
- asp.net自定义错误页面
- asp.net自定义错误页面
- asp.net自定义错误页面
- asp.net自定义错误页面
- asp.net自定义错误页面及出错分析
- asp.net 自定义错误页面 问题
- [VB.NET]权限管理问题
- 如何用STAR方法做好ERP项目选型?
- SQLServer查询所有表所有字段包含xx的信息
- Window_Open详解
- [VB.NET]请问有没有分割线似的控件啊?
- ASP.NET 记录页面错误及自定义错误页
- asp.net页面加载时间计算
- [VB.NET]关于VB2005创建NT服务的问题.
- “5.12”四川汶川大地震有感
- 把 Visual Studio .NET 源代码文件中C# XML注释提取成工程文档
- ERP选型别看广告看实效
- [VB.NET]求处理访问千万像素图片的读取,放大与缩小速度的思路~~~
- 杨老师 个人专栏(com/ATL设计基础知识,太精彩了)
- [VB.NET]Microsoft Visual Studio .NET 2003怎么升级到2005