Accessing ASP3.0 Session Object from .NET comp ...

Arogl Darthu's Blog

  • Homepage

Dec 13: Accessing ASP3.0 Session Object from .NET component

New project, new challenge... How true. A coworker came to me with the following issue:
In an ASP3.0 web application we call a .NET component and we want to access the intrinsic ASP objects (for instance the Session object) from there. Now in a legacy VB COM component you would just reference mtsax.dll, declare a variable as ObjectContext and call GetObjectContext.

Private ObjectContext As MTxAS.ObjectContext
Private Session As ASPTypeLibrary.Session

Set ObjectContext = GetObjectContext()
Set Session = ObjectContext("Session")
 

After reading a lot about session integration between ASP.NET and ASP3.0 (which I was not looking for), the answer turned out to be extremely simple. Sometimes it is just a matter of looking at the right place. To quote Ohad Israeli, who pointed me in the right direction:
The answer is always there…
the problem is that you just don’t look at the right place :-)


Dim objAppServer As COMSVCSLib.AppServer
Dim objContext As COMSVCSLib.ObjectContext
Dim objSession As ASPTypeLibrary.Session

objAppServer = New COMSVCSLib.AppServer
objContext = objAppServer.GetObjectContext()
objSession = objContext("Session")      'Obtain ASP Session object.
 

Posted by Twan Jacobs in WTF Comments: (0) Trackbacks: (0)

Trackbacks
Trackback specific URI for this entry

No Trackbacks

Comments
Display comments as (Linear | Threaded)

No comments


Add Comment

Enclosing asterisks marks text as bold (*word*), underscore are made via _word_.
You can use [geshi lang=lang_name [,ln={y|n}]][/geshi] tags to embed source code snippets.
Standard emoticons like :-) and ;-) are converted to images.
E-Mail addresses will not be displayed and will only be used for E-Mail notifications.

To prevent automated Bots from commentspamming, please enter the string you see in the image below in the appropriate input box. Your comment will only be submitted if the strings match. Please ensure that your browser supports and accepts cookies, or your comment cannot be verified correctly.
CAPTCHA

 
 

Calendar

Back February '12
Mo Tu We Th Fr Sa Su
    1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29        

Archives

  • February 2012
  • January 2012
  • December 2011
  • Recent...
  • Older...

Categories

  • XML BizTalk
  • XML Daily Didst
  • XML Infra
  • XML SQL
  • XML WCF
  • XML WTF


All categories

Syndicate This Blog

  • XML RSS 2.0 feed
  • XML RSS 2.0 Comments

Blog Administration

Open login screen

Powered by

Serendipity PHP Weblog
 

Layout by Andreas Viklund | Serendipity template by Carl