G
Guest
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?
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?