Re: Hooking UnhandledException in .NET module invoked in classic ASP
From: David Browne (meat_at_hotmail.com)
Date: 03/07/05
- Next message: Sharon: "c# checking if Time in time interval"
- Previous message: Ian Borland: "Wrong datatype returned - possible bug?"
- In reply to: John Snook: "Hooking UnhandledException in .NET module invoked in classic ASP"
- Next in thread: John Snook: "Re: Hooking UnhandledException in .NET module invoked in classic A"
- Reply: John Snook: "Re: Hooking UnhandledException in .NET module invoked in classic A"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 7 Mar 2005 10:58:55 -0600
"John Snook" <JohnSnook@discussions.microsoft.com> wrote in message
news:44117C22-276F-4722-BFC4-71F739A06049@microsoft.com...
>I posted this question in microsoft.public.dotnet.framework.interop but got
> zero replies in 5 days so I'm reposting in the general framework group
> hoping
> someone's got some insight:
>
> We have a large IIS/SQL classic ASP site that we are converting to .NET by
> abstracting functionality into .NET components/methods which are also
> installed/registered as COM objects so they can by invoked by new ASPX
> pages
> as well as by our current ASP pages (Set xxx = Server.CreateObject)
>
> My question is how do I hook a handler into the UnhandledException chain
> for
> my ASP page invoked components via (Set ThisObj =
> Server.CreateObject("MyLib:MyObj")?
>
> The section of my code where I hook the chain is:
>
> If System.Web.HttpContext.Current Is Nothing Then
> 'Instantiated in the classic ASP environment
> ' ??? What goes here ???
> Else
> 'Instantiated in the ASPX environment
> Dim HttpApplication As System.Web.HttpApplication =
> System.Web.HttpContext.Current.ApplicationInstance
> AddHandler HttpApplication.Error, AddressOf
> HandleHttpExceptions
> ' This works fine to catch exceptions in the .NET assembly on
> ASPX pages
> End If
>
> I've tried the standard console application hooking:
>
> Dim CurrentDomain As AppDomain = System.AppDomain.CurrentDomain
> AddHandler CurrentDomain.UnhandledException, AddressOf
> HandleUnhandledExceptions
>
> but that doesn't seem to work across the interop/COM boundaries.
>
> Anybody got any light to shed on where the UnhandledException event chain
> lives when the .NET assembly is registered as a COM object and invoked by
> IIS's object structure?
I beleive that the managed exception is "handled" by the CCW. The exception
is caught and and a COM error is passed to COM. So the error propagates out
to the COM client and it is not unhandled. It's up to the COM client to do
something useful with the error then.
David
- Next message: Sharon: "c# checking if Time in time interval"
- Previous message: Ian Borland: "Wrong datatype returned - possible bug?"
- In reply to: John Snook: "Hooking UnhandledException in .NET module invoked in classic ASP"
- Next in thread: John Snook: "Re: Hooking UnhandledException in .NET module invoked in classic A"
- Reply: John Snook: "Re: Hooking UnhandledException in .NET module invoked in classic A"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|