How to raise exception which automatically written to Application event log?

G

GS

I have noticed that ASP.NET 2.0 writes unhandled exceptions automatically to event log. How do I that on purpouse in a code? Say I have hit error condition and would like to abort current thread and throw exception which will be automatically written in event log?

Thanks,
G
 
K

Karl Seguin [MVP]

Global.asax has an Application_Error event which fires whenever an unhandled exception bubbles up. You can throw a new exception whereever you want and handle it (log it) in that funciton. take a look at:
http://support.microsoft.com/default.aspx?scid=kb;en-us;306355

Karl

--
http://www.openmymind.net/



I have noticed that ASP.NET 2.0 writes unhandled exceptions automatically to event log. How do I that on purpouse in a code? Say I have hit error condition and would like to abort current thread and throw exception which will be automatically written in event log?

Thanks,
G
 
G

GS

Excellent,

Thanks.
Global.asax has an Application_Error event which fires whenever an unhandled exception bubbles up. You can throw a new exception whereever you want and handle it (log it) in that funciton. take a look at:
http://support.microsoft.com/default.aspx?scid=kb;en-us;306355

Karl

--
http://www.openmymind.net/



I have noticed that ASP.NET 2.0 writes unhandled exceptions automatically to event log. How do I that on purpouse in a code? Say I have hit error condition and would like to abort current thread and throw exception which will be automatically written in event log?

Thanks,
G
 

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,995
Messages
2,570,236
Members
46,822
Latest member
israfaceZa

Latest Threads

Top