Saturday, March 24, 2012

Strange error handling problem

hi guys,

I have enabled error handling in my application through web.config and also using global.asax file.. but whenever there's any error in my application I am just transferred to default error page which is defined in web.config..

I want the code in global.asax file to take care of the error message as compared to web.config file..

what am i missing ??

web.config


<customErrors mode="RemoteOnly" defaultRedirect="~/Error/Default.aspx"/>

Global.asax


' Fires when an error occurs
Dim ptr As New SystemFunctions
ptr.SendExceptionReport(Session, Request, Server.GetLastError().InnerException, "MyWebApp")
Response.Redirect("~/Error/")
Hi,

Remove the Response.Redirect in the Global.asax file.

The default error page will anyway be shown since you specify it in the web.config. The problem is when there is a response.redirect, it is first executed irrespective of other statements.

Try removing the response.redirect.

write back if it doesn't help.

thanks.

0 comments:

Post a Comment