Passing VB OLE objects in the Application object (IIS3, VB5, ASP, VBS) 
Author Message
 Passing VB OLE objects in the Application object (IIS3, VB5, ASP, VBS)

Hello Nick :-), how the h*ll ya been

Try the extended Object tag while giving the Object Application scope
instead of CreateObject.  that might just work :-)
--
Ibrahim
A MS Developer MVP
====================
Malluf Consulting Services

http://www.*-*-*.com/
===================================
Check out the latest ViewSource column:
http://www.*-*-*.com/
===================================
My {*filter*}: http://www.*-*-*.com/



Quote:
> If anyone can offer an explaination for this, I would appreciate it.

> I have created an in-process ActiveX Dll (marked for unattended
execution)
> in VB5.  I can create an instance of the object in an ASP page just fine.
> However, I want to create the instance in the global.asa
> Application_OnStart event, and pass the object from page to page in the
> Application object, like this:

>    Sub Application_OnStart
>       Set MyObj = Server.CreateObject("foo.bar")
>       Set Application("foobar") = MyObj
>    End Sub

> ---------
> Then, in an ASP page, I could do this:
>    Set MyLocalObj = Application("foobar")
>    MyLocalObj.SomeProperty = 1
>    MyLocalObj.SomeMethod

> This works in MS Commerce Server with the commerce server objects.  I am
> doing a commerce application, so I am leveraging the model.  

> However, unlike commerce server, I did not write my objects in C++.  I
> wrote them in VB5.  

> What I am trying to do does not work.  I get no errors in the global.asa.
> In fact, I can verify that the object is correctly created and works just
> fine in the global.asa.  The reference, however, does not survive through
> the Application object assignment.  I get an error message on the "Set
> MyLocalObj = Application("foobar")" line above, stating that an object is
> required.  That is the error message that the 'Set' statement gives when
> the right hand side is not an object reference.

> I can move the object creation to the page level, but that defeats the
> purpose (due to my design, which I am beginning to regret).  

> Does anyone know of a way that I can work around this problem, and allow
> the VB object reference to be correctly assigned into and out of the
> Application object?

> --- Nick Malik

>     VB MVP



Mon, 07 Feb 2000 03:00:00 GMT  
 Passing VB OLE objects in the Application object (IIS3, VB5, ASP, VBS)

Hello Ibrahim,
Long time, no see!

Could you give me a snippet to demonstrate what you mean?

--- Nick



Quote:
> Hello Nick :-), how the h*ll ya been

> Try the extended Object tag while giving the Object Application scope
> instead of CreateObject.  that might just work :-)
> --
> Ibrahim
> A MS Developer MVP



Mon, 07 Feb 2000 03:00:00 GMT  
 Passing VB OLE objects in the Application object (IIS3, VB5, ASP, VBS)

VB5 creates COM servers that support the apartment threading model.
You typically would not want to create apartment-threaded objects with
application  or session scope unless you are willing to live with the
severe performance hit that results.

See the ASP roadmap for more details on this.

Quote:

>If anyone can offer an explaination for this, I would appreciate it.

>I have created an in-process ActiveX Dll (marked for unattended execution)
>in VB5.  I can create an instance of the object in an ASP page just fine.
>However, I want to create the instance in the global.asa
>Application_OnStart event, and pass the object from page to page in the
>Application object, like this:

>   Sub Application_OnStart
>      Set MyObj = Server.CreateObject("foo.bar")
>      Set Application("foobar") = MyObj
>   End Sub

>---------
>Then, in an ASP page, I could do this:
>   Set MyLocalObj = Application("foobar")
>   MyLocalObj.SomeProperty = 1
>   MyLocalObj.SomeMethod

>This works in MS Commerce Server with the commerce server objects.  I am
>doing a commerce application, so I am leveraging the model.  

>However, unlike commerce server, I did not write my objects in C++.  I
>wrote them in VB5.  

>What I am trying to do does not work.  I get no errors in the global.asa.
>In fact, I can verify that the object is correctly created and works just
>fine in the global.asa.  The reference, however, does not survive through
>the Application object assignment.  I get an error message on the "Set
>MyLocalObj = Application("foobar")" line above, stating that an object is
>required.  That is the error message that the 'Set' statement gives when
>the right hand side is not an object reference.

>I can move the object creation to the page level, but that defeats the
>purpose (due to my design, which I am beginning to regret).  

>Does anyone know of a way that I can work around this problem, and allow
>the VB object reference to be correctly assigned into and out of the
>Application object?

>--- Nick Malik

>    VB MVP

actual e-mail hostname is cais.com. If you reply by email
then change the destination hostname to the above.


Tue, 08 Feb 2000 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. VBA-assigning an OLE-object to an Ole-object-field

2. ObjectContext vs. Passing ASP objects from ASP page

3. Passing objects to VB created ole servers

4. Passing objects to VB created ole servers

5. Problem passing VB COM+ ASP Request object to .NET component System.Web.HTTPRequest through COM interop

6. Passing Form Fields to VB.NET Custom Business Object in an ASP.NET Code Behind Page

7. Passing word object to ASP from vb dll

8. How to pass array from ASP to VB object

9. Passing Dictionary object from ASP to VB..

10. How to pass connection object to asp page from VB

11. OLE: Using Excel's Application object in VB

12. passing an application object from a dll to an application

 

 
Powered by phpBB® Forum Software