这个例子对我有用,我试过 Response.write 但我什么也没得到。这是示例(是否也可能出现一个弹出窗口告诉错误详细信息“)
protected void Application_Error(object sender, EventArgs e)
{
// At this point we have information about the error
HttpContext ctx = HttpContext.Current;
Exception exception = ctx.Server.GetLastError ();
string errorInfo =
"<br>Offending URL: " + ctx.Request.Url.ToString () +
"<br>Source: " + exception.Source +
"<br>Message: " + exception.Message +
"<br>Stack trace: " + exception.StackTrace;
ctx.Response.Write (errorInfo);
ctx.Server.ClearError ();
}