Home > Error Handling > Get Error Message From Application_error

Get Error Message From Application_error

Contents

Debug.Write(ex.Message);} // clear the error and put a custom message on the page Server.ClearError(); Response.Write("We're Sorry...");Response.Write("An error has occured on the page you were requesting.Your System Administrator has been notified
"); Using or modifying the code below. Using this attribute uses the standard filter processing in MVC and builds the page using views rather than writing directly to the response as you might do using Application_Error. So I simply do this in global.asax: void Application_error(object sender, EventArgs e) { SendMessageToAdministarator(Server.GetLastError().ToString()); } But actually many times Application_Error is called even though the application won't crash. check my blog

If the mode is set to "Off," potentially compromising information about your Web site can be exposed to anyone who can cause an error to occur on your site. C#VB Copy <%@ Page Language="C#" %>