logo       

Re: web.config - custom excption handling.: msg#00092

windows.devel.dotnet.web

Subject: Re: web.config - custom excption handling.

Well, I'm not familiar with the Exception App Block, but in ASP.NET you can
write a single bit of code for the entire application that will be notified
of unhandled exceptions. It's perfect for logging when your application
experiences a failure.

So, in global.asax:

void Application_Error(Object sender, EventArgs e)
{
Exception ex = HttpContext.Current.Error;
if (ex is HttpUnhandledException)
{
// The Excpetion was from the application (as opposed to something
from ASP.NET)
ex = ex.InnerException;
}

// At this point, ex is the Exception that was the problem
// ...
}

Once you have 'ex' from above, then you can write it to a log file, or the
event log, email to someone... Whatever. This is the typical pattern in
ASP.NET for tracking unexpected errors.

HTH

-Brock
http://staff.develop.com/ballen


> -----Original Message-----
> From: Discussion of building .NET applications targeted for
> the Web [mailto:DOTNET-WEB@xxxxxxxxxxxxxxxxxxx] On Behalf Of
> Jennifer Quinn
> Sent: Friday, January 21, 2005 4:02 PM
> To: DOTNET-WEB@xxxxxxxxxxxxxxxxxxx
> Subject: [DOTNET-WEB] web.config - custom excption handling.
>
> In vb.net I add the following to my app.config file, and my custom
> exception handling works like a charm...using the custom
> handler I wrote
> called DBExceptions.
> ========
> <configSections>
> <section name="exceptionManagement"
>
> type="Microsoft.ApplicationBlocks.ExceptionManagement.Exceptio
> nManagerSectionHandler,
> Microsoft.ApplicationBlocks.ExceptionManagement" />
> </configSections>
>
> <exceptionManagement>
> <publisher mode="on" assembly="DBExceptions"
> type="DBExceptions.DBExceptionPublisher" />
> </exceptionManagement>
> ========
>
> I want my asp.net pages to use this same custom handler, rather than
> the eventlog, but the web.config file won't have anything to
> do with the
> above settings.
>
> I'm sorry I'm such an idiot, but if anyone would advise anyway, I'd be
> appreciative.
>
> Thanks a bunch.
>
> ===================================
> This list is hosted by DevelopMentor. http://www.develop.com
>
> View archives and manage your subscription(s) at
> http://discuss.develop.com
>

===================================
This list is hosted by DevelopMentor® http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com



<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise