0
You can use web.config to add custom error page. But one problem is you cannot log the exception.
- <configuration>
- <appSettings/>
- <connectionStrings/>
- <system.web>
- <compilation debug="true" />
-
-
- <customErrors mode="On"
- defaultRedirect="DefaultRedirectErrorPage.aspx">
- <error statusCode="404" redirect="Http404ErrorPage.aspx"/>
- </customErrors>
-
- </system.web>
- </configuration>
So it is better to use Global.asax to get exception and logit.
- void Application_Error(object sender, EventArgs e)
- {
-
-
-
- Exception exc = Server.GetLastError();
-
-
-
- Response.Write("<h2>Global Page Error</h2>\n");
- Response.Write(
- "<p>" + exc.Message + "</p>\n");
- Response.Write("Return to the <a href='Default.aspx'>" +
- "Default Page</a>\n");
-
-
- ExceptionUtility.LogException(exc, "DefaultPage");
-
-
- Server.ClearError();
- }
0
Hi Narasiman,
I think you cannot do this without touching the code, Surely you need to touch the code to implement custom error handling or common try catch exception.
You may find some other way to do this. If I know , I will reply soon.