Relicate default error page

  • Thread starter Thread starter bmjnine
  • Start date Start date
B

bmjnine

Hi all,

I'm using Application_Error in Global.asax to send myself an email
when a server error occurs on my site. It's been working fine. However
I just realized that by using this override, the error message no
longer is displayed to the user. So I just want to include some code
to replicate the default error page to the screen.

Is there some sort of "display default server error" method to produce
what you would normally see without custom error handling?

If not, I would like to stick to a similar layout and order when
displaying the source, message, innerexception, stacktrace, etc.
Anyone know what that would be? I always get them mixed up, and would
prefer not to go causing errors on the site to figure it out.

Thanks,
Alyssa
 
I'm using Application_Error in Global.asax to send myself an email
when a server error occurs on my site. It's been working fine. However
I just realized that by using this override, the error message no
longer is displayed to the user.


I cannot reproduce this, when I do:

void Application_Error(object sender, EventArgs e)
{
Exception ex = Server.GetLastError();
System.Net.Mail.MailMessage mail = new
[snip creating mail]
smtp.Send(mail);
}

The mail gets send and with customErrors mode="Off", the exception is
still shown with the default error page.

Ben
 
Back
Top