Home All Groups Group Topic Archive Search About

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

Author
7 Jan 2006 8:20 PM
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

Author
7 Jan 2006 8:33 PM
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

  "GS" <n*@no.com> wrote in message news:OqSiJf8EGHA.1148@TK2MSFTNGP10.phx.gbl...
  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
Author
7 Jan 2006 8:46 PM
GS
Excellent,

Thanks.
  "Karl Seguin [MVP]" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net> wrote in message news:eQMBvm8EGHA.3064@TK2MSFTNGP10.phx.gbl...
  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/



    "GS" <n*@no.com> wrote in message news:OqSiJf8EGHA.1148@TK2MSFTNGP10.phx.gbl...
    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

AddThis Social Bookmark Button