To catch the errors anywhere in your site, do the following. Add the following lines in your
Global.asax
file within
Application_Error
.
void Application_Error(object sender, EventArgs e)
{
Exception objErr = Server.GetLastError().GetBaseException();
string err = "Error in: " + Request.Url.ToString() +
". Error Message:" + objErr.Message.ToString();
}
I didn't implement the email sending in the above code. Please refer to the following link for how to send email.
Send email links
Feel free to contact for further information.