.NET Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgramming.NET Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old March 22nd, 2002, 01:23 PM
Steve Schofield Steve Schofield is offline
Contributing User
ASP Free God 20th Plane (14500 - 14999 posts)
 
Join Date: Dec 2002
Posts: 14,575 Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 23
Using Session Variables with COM objects

<i><b>Originally posted by : Dan (dan@smeadlink.com)</b></i><br />I am creating a Session variable for a COM object in Global.asax and passing it on to another ASPX page. In that page I create a local variable of that object, set the value and then set the Session variable to that object. In another ASPX page I create a local variable of that object and set it equal to the Session variable object. When I try to reference a property from the new local variable, I get a Cast error. But if I usa a late bound reference to the Session variable object, I get the value I need. Any ideas?<br /><br />Here's the code:<br /><br />GLOBAL.ASAX.VB<br /> Dim oAppEngine As SLDBEng.RMAGDBEngine_obj<br /><br /> Session.Add("AppEngine", Nothing)<br />---------------------------------------<br />PAGE1.ASPX.VB<br /> Dim oAppEngine As New SLDBEng.RMAGDBEngine_obj()<br /> <br /> Session.Item("AppEngine") = oAppEngine<br /> oAppEngine = Session.Item("AppEngine") 'Set back to itself so I could verify the next line was getting the value of the Session variable<br /> Response.Write(oAppEngine.MinorVersion)<br />---------------------------------------<br />PAGE2.ASPX.VB<br /> Dim oAppEngine As SLDBEng.RMAGDBEngine_obj<br /><br /> oAppEngine = Session.Item("AppEngine")<br /> Response.Write(oAppEngine.MinorVersion) 'This will give the Cast Exception Error<br /> Response.Write(Session("AppEngine").MinorVersion) 'Using the late bound reference works<br /><br />Here's the error:<br /> System.InvalidCastException: QueryInterface for interface SLDBEng._RMAGDBEngine_obj failed.<br /><br />No idea why it references the object name with an underscore. The object does not have an underscore in the name.<br />

Reply With Quote
Reply

Viewing: ASP Free ForumsProgramming.NET Development > Using Session Variables with COM objects


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway
Stay green...Green IT