Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / July 2005

Tip: Looking for answers? Try searching our database.

Error Handling

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
michaeltorus - 20 Jul 2005 09:17 GMT
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
Kevin Spencer - 20 Jul 2005 13:55 GMT
> 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.

Signature

HTH,

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

> Hi
>
[quoted text clipped - 14 lines]
> ---
> Posted using Wimdows.net Newsgroups - http://www.wimdows.net/newsgroups/ 
Brock Allen - 20 Jul 2005 14:39 GMT
>> 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.

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.

-Brock
DevelopMentor
http://staff.develop.com/ballen
michaeltorus - 20 Jul 2005 14:42 GMT
Is this still the same when my objects raises the Event?
Kevin Spencer - 20 Jul 2005 16:01 GMT
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.

Signature

HTH,

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

> Is this still the same when my objects raises the Event?
>
> ---
> Posted using Wimdows.net Newsgroups - http://www.wimdows.net/newsgroups/ 

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.