Difference between Application_error and web.config?

Hi.

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.

Regards

I
ianinspainAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

mmarinovCommented:
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ianinspainAuthor Commented:
Wow ...yep that explains everything cool!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP.NET

From novice to tech pro — start learning today.