I have the following in my Global.aspx which is meant for handling errors:
void Application_Error(object sender, EventArgs e)
{
Exception exception = Server.GetLastError();
if (exception != null)
{
//Log
if (HttpContext.Current.Server != null)
{
HttpContext.Current.Server.Transfer("/siteerror.aspx");
}
}
}
This works for the most part, but sometimes does not get into Server.Transfer. For some reason HttpContext.Current.Server is null. I figured out where this happens: when errors occur in a user control and in my business logic classes. Am I missing something here?
Thanks
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With