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

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top