ASP/VB - OnStartPage & ScriptingContext?
I have a Webclass WebClassA which is instantiated from an ASP page via the WebClassManager. WebClassA then instantiates another class ClassB, which is just a normal class, not a webclass. I need ClassB to have access to ASP's ScriptingContext so I can use the Server and Response objects.
So in ClassB I make a call to ..
Set oServer = GetObjectContext.Item("Server")
... to grab a handle to the server. This works fine when the DLL is compiled, but it's no use when I'm just running it through the VB IDE. I want to set a "DEBUG" compiler conditional so that I can just set this flag when debugging to make a different call to ...
Public Sub OnStartPage(PassedScriptingContext as ScriptingContext)
Set oServer = PassedScriptingContext .Server
..
End Sub
... in the "OnStartPage" of the class.
The problem here is that OnStartPage is ONLY called when the class is instantiated from ASP. My class is instantiated from a WebClass, not an ASP page. Does anyone know of a way to grab a hold of the ASP ScriptingContext in debug mode other than GetObject() and OnStartPage? Or better yet, does anyone know of a way to force the compiler to call OnStartPage when a class is instantiated, regardless of where from?