62,046
社区成员
发帖
与我相关
我的任务
分享
/*
void Application_Error(object sender, EventArgs e)
{
//在出现未处理的错误时运行的代码
Exception objErr = Server.GetLastError().GetBaseException();
string error = string.Empty;
string errorTime = string.Empty;//发生异常时间
string errorAddr = string.Empty;//发生异常页
string errorInfo = string.Empty;//发生异常信息
string errorSource = string.Empty;//错误源
string errorTrace = string.Empty;//堆栈源
errorTime = "时间:" + System.DateTime.Now.ToString();
error += "时间:" + System.DateTime.Now.ToString() + "<br/>";
errorAddr = "异常页:" + Request.Url.ToString();
error += "异常页:" + Request.Url.ToString() + "<br/>";
errorInfo = "异常信息:" + objErr.Message;
error += "异常信息:" + objErr.Message + "<br/>";
errorSource = "错误源:" + objErr.Source;
error += "错误源:" + objErr.Source + "<br/>";
errorTrace = "堆栈源:" + objErr.StackTrace;
error += "堆栈源:" + objErr.StackTrace + "<br/>";
error += "------------------------------------------<br/>";
Server.ClearError();
Application["Error"] = error;
System.IO.StreamWriter writer = null;
////////////省略N行
}*/