ObjectContext In ActiveX-DLL and WinXP: Error 91 
Author Message
 ObjectContext In ActiveX-DLL and WinXP: Error 91

Hi,
I'm developing a component and wish to use the ASP library. It's got to run
on a Windows XP platform and there, just like Win 2000 had (after SP2 not
anymore), I get the "Error 91 - Object variable or With block variable not
set" error message when calling ObjectContext.
Does anybody know how to solve this (searched all over the internet, but not
much success)?

Here's the code (logically, I get the error when Class_Initialize() starts):

Option Explicit

'Implementing the ObjectControl interface
Implements ObjectControl
'The ObjectContext property
Private objContext As ObjectContext
'Declare variables
Private Request As Request
Private Response As Response
Private Session As Session
Private Application As Application
Private Server As Server

Private Sub Class_Initialize()
    'Obtain ASP Response objects
    Set Response = objContext("Response")
    Set Request = objContext("Request")
    Set Session = objContext("Session")
    Set Application = objContext("Application")
    Set Server = objContext("Server")
End Sub

Private Sub ObjectControl_Activate()
    Set objContext = GetObjectContext()
End Sub

Private Function ObjectControl_CanBePooled() As Boolean
     ObjectControl_CanBePooled = False
End Function

Private Sub ObjectControl_Deactivate()
    Set objContext = Nothing
End Sub

Public Function MapPath(strUrl As String) As String
    MapPath = Server.MapPath(strUrl)
End Function



Sun, 03 Oct 2004 20:57:13 GMT  
 ObjectContext In ActiveX-DLL and WinXP: Error 91
Once I got it working, but cannot reproduce it this time. I also remember
that is was not always stable.
Anothing approach is to pass all the ASP object you need, from the APS code,
to the component.
Like this:
'In your Dll:
Public Sub Initialize (byval objResponse as Response, byval objRequest as
request etc)
    Set m_objResponse = objResponse
  Set m_objRequest = objRequest
end sub

etc.
Good luck.


Quote:
> Hi,
> I'm developing a component and wish to use the ASP library. It's got to
run
> on a Windows XP platform and there, just like Win 2000 had (after SP2 not
> anymore), I get the "Error 91 - Object variable or With block variable not
> set" error message when calling ObjectContext.
> Does anybody know how to solve this (searched all over the internet, but
not
> much success)?

> Here's the code (logically, I get the error when Class_Initialize()
starts):

> Option Explicit

> 'Implementing the ObjectControl interface
> Implements ObjectControl
> 'The ObjectContext property
> Private objContext As ObjectContext
> 'Declare variables
> Private Request As Request
> Private Response As Response
> Private Session As Session
> Private Application As Application
> Private Server As Server

> Private Sub Class_Initialize()
>     'Obtain ASP Response objects
>     Set Response = objContext("Response")
>     Set Request = objContext("Request")
>     Set Session = objContext("Session")
>     Set Application = objContext("Application")
>     Set Server = objContext("Server")
> End Sub

> Private Sub ObjectControl_Activate()
>     Set objContext = GetObjectContext()
> End Sub

> Private Function ObjectControl_CanBePooled() As Boolean
>      ObjectControl_CanBePooled = False
> End Function

> Private Sub ObjectControl_Deactivate()
>     Set objContext = Nothing
> End Sub

> Public Function MapPath(strUrl As String) As String
>     MapPath = Server.MapPath(strUrl)
> End Function



Mon, 04 Oct 2004 03:07:15 GMT  
 ObjectContext In ActiveX-DLL and WinXP: Error 91
I was afraid there was no 'more elegant' solution than this, but it should
work at least.
Thanks!


Quote:
> Once I got it working, but cannot reproduce it this time. I also remember
> that is was not always stable.
> Anothing approach is to pass all the ASP object you need, from the APS
code,
> to the component.
> Like this:
> 'In your Dll:
> Public Sub Initialize (byval objResponse as Response, byval objRequest as
> request etc)
>     Set m_objResponse = objResponse
>   Set m_objRequest = objRequest
> end sub

> etc.
> Good luck.



> > Hi,
> > I'm developing a component and wish to use the ASP library. It's got to
> run
> > on a Windows XP platform and there, just like Win 2000 had (after SP2
not
> > anymore), I get the "Error 91 - Object variable or With block variable
not
> > set" error message when calling ObjectContext.
> > Does anybody know how to solve this (searched all over the internet, but
> not
> > much success)?

> > Here's the code (logically, I get the error when Class_Initialize()
> starts):

> > Option Explicit

> > 'Implementing the ObjectControl interface
> > Implements ObjectControl
> > 'The ObjectContext property
> > Private objContext As ObjectContext
> > 'Declare variables
> > Private Request As Request
> > Private Response As Response
> > Private Session As Session
> > Private Application As Application
> > Private Server As Server

> > Private Sub Class_Initialize()
> >     'Obtain ASP Response objects
> >     Set Response = objContext("Response")
> >     Set Request = objContext("Request")
> >     Set Session = objContext("Session")
> >     Set Application = objContext("Application")
> >     Set Server = objContext("Server")
> > End Sub

> > Private Sub ObjectControl_Activate()
> >     Set objContext = GetObjectContext()
> > End Sub

> > Private Function ObjectControl_CanBePooled() As Boolean
> >      ObjectControl_CanBePooled = False
> > End Function

> > Private Sub ObjectControl_Deactivate()
> >     Set objContext = Nothing
> > End Sub

> > Public Function MapPath(strUrl As String) As String
> >     MapPath = Server.MapPath(strUrl)
> > End Function



Mon, 04 Oct 2004 18:59:19 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Error 91 (800A005B) accessing collection in an ActiveX DLL

2. HELP : Error 91 : Run-Time Error 91 Object Variable or With

3. DCOM ERROR Run-time error "91"

4. Please help with VB4.0 Object Server error and error 91

5. objectcontext make dll error

6. error 91 with block variable not set

7. db = CurrentDb returns error 91 in project

8. Error 91 - Object Variable Not Set **** Need Help

9. Help needed with SQL (runtime Error 91)

10. Runtime error 91

11. Object variable not set (error 91) ???

12. Multi Select getting Error 91

 

 
Powered by phpBB® Forum Software