Error Handling

M

michaeltorus

Hi

I've written a custom Error handler thingy majig. I create it at the ASP level, and pass it into my business components which catch all errors below that. When an error occurs, my error handler onject fire and event, which the ASP.Net page is listening for.

What I want to know is, does this mean that my error handling on the ASP page is effectivley done on another thread?

Are there any risks in doing it this way?

Cheers

Mike
 
K

Kevin Spencer

What I want to know is, does this mean that my error handling on the ASP
page is effectivley done on another thread?

Events are asynchronous, yes.
Are there any risks in doing it this way?

Multi-threading does involve risk. Events are probably less risky in
general, but as the event handlers fire asynchronously, you do have to be
responsible for what they do, avoid race conditions, deadlocks, that sort of
thing. for example, if the event handler attempts to modify a field or
property in the class, you may want to use locking. Also, be aware that the
event handler fires out of sequence, and could fire at any time, and account
for it in your code.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
The sun never sets on
the Kingdom of Heaven
 
B

Brock Allen

What I want to know is, does this mean that my error handling on the
Events are asynchronous, yes.

I think this is a bit misleading. The Page_Error is called on the same thread
that executes the page. Once the page encounters an exception it first looks
for a Page_Error handler on that page and calls it synchronously (from the
same thread). It then will look for an Application_Error (from global.asax)
and then call that. It is asynchronous in the sense that you don't know when
you'll have an exception, but there is no thread switch.
 
K

Kevin Spencer

Is what still the same as what? If you're talking about Brock's mention of
Page_Error, no. In your case, it would be as I described it to you.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
The sun never sets on
the Kingdom of Heaven
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,997
Messages
2,570,240
Members
46,830
Latest member
HeleneMull

Latest Threads

Top