Writing an exception to both the event log and to an error page

  • Thread starter Thread starter Nam
  • Start date Start date
N

Nam

In a C# class of an ASP.NET application, I am logging the exceptions to the
windows even log. How can I simultaneously propagate the exception on top and
let the Page that calls that C# class to catch the exception?

After catching the exception, I would redirect a customized message to an
error page.

Thank you in advance.
 
Should just have to rethrow it.

Try
<code>
Catch Ex as Exception
<code here to log to event log>
Throw Ex
End Try
 
I would try this, which I think keeps the original stack trace.


try
{

}
catch (Exception ex)
{

//publish it to the event log
throw;

}


Or change it to
throw ex;

But there is a subtle difference.
 
Back
Top