I am trying to implement some error checking, well a global error handler really.
I have opted out of Page_error and have been looking at 2 other ways either using
1. the web.config and insert a RedirectURL in CustomErrors
2. Using application_error of global.asx
I was after some comments and confirmation of what I think I have found.
1. Using the web.config, basically transfers to a default url that i specify, problem with this is the URL is displayed in IE/Opera etc.. so its possible to bookmark it. And i don't want people to bookmark an error.aspx page
2. To get the error and display something on the Redirected url then i use Server.GetLastError for example?
3. I presume once i arrive in the RedirectedURL for the customerrors then I have to clear the error, jsut wondering why this is?
Then i looked at the Application_Error which technically as far as i can see is similar, I can catch the errors here and then do a Server.Transfer rather a Response.redirect and the URL is left alone i.e. it still displays the page where the error happened, so the user wouldn't be able to Bookmark the error.aspx page. Once I have done a server.transfer to the new page and i arrive in the new page (.aspx) then I can again use the Server.GetLastError to find out what the last error was a give a nicely formattted error page?
I was reading somewhere that I have to CLEAR the error once I arrive in the new page, is this correct? Why?
Does anyone know what the PROS and CONS are of using either of the above??
Also if I arrive in Applicatiion_error and I can recover the problem then I presume I can clear the error and server.transfer back to the original webform??
AND if I use both a Application_Error and a Customerrros RedirectURL (in web.config), are they both executed, Application_error FIRST and then the customerror redirectURL?
I know if i use a Page_Error and an application_Error then the page_error is executed and not the application_error.
Just a little confused on what to do, any advise or comments that anyone can offer would be really great.