Reputation: 3502
this example dosent work for me ,I tried Response.write but I am getting nothing. here is the sample (is it also possiable come up a pop up window tell the error detail")
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 ();
}
Upvotes: 2
Views: 2144
Reputation: 6050
Method signature of an event that is fired when an unhandled exception is encountered within the application in Global.asax is:
void Application_Error(object sender, EventArgs e)
{
// your code...
}
Upvotes: 2