void Page_Error(object sender, EventArgs e) { //Get current URL string GetCurrentURL = Request.Url.ToString(); //Get the Exception error string GetExceptionError = Server.GetLastError().ToString(); //Log Exception Error Blogic.LogExceptionError(GetCurrentURL, GetExceptionError); //Instantiate email temple object EmailTemplate SendEmailNotification = new EmailTemplate(); SendEmailNotification.SendExceptionErrorNotification(GetCurrentURL, GetExceptionError); SendEmailNotification = null; //Redirect to the error page. Server.Transfer("error.aspx"); }