Multithreading in Application_Error event handler?

R

ram

Hi,

In Application_Error (global.asax) i'm sending the details of the
exception to
a file (opening and closing file each time).

I'm using the same file (eg, log.txt) for all logs.

Are the calls to this method serialized?

It's possible that, when trying to write to the file, the file is
already opened by another thread?


TIA,
ram
 
S

Sami Vaaraniemi

ram said:
Hi,

In Application_Error (global.asax) i'm sending the details of the
exception to
a file (opening and closing file each time).

I'm using the same file (eg, log.txt) for all logs.

Are the calls to this method serialized?

In my experience, no.
It's possible that, when trying to write to the file, the file is
already opened by another thread?

Yes. If you want to write to the file from multiple threads, you need to
synchronize your code.

Regards,
Sami
 

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

Members online

Forum statistics

Threads
473,755
Messages
2,569,534
Members
45,008
Latest member
Rahul737

Latest Threads

Top