COM Component instance in session_onstart()???????

Results 1 to 2 of 2

Thread: COM Component instance in session_onstart()???????

  1. #1
    Join Date
    Dec 1969

    Default COM Component instance in session_onstart()???????

    Hi.........<BR> I have developed a shopping cart COM component. I want to create its instance in the session_onstart() [i know its not right but its just an assignment and i want to get over it]. <BR> <BR>When I say session("var")=1 , i am creating a session variable, whose scope is available across the app and whose state is persistant for the session. my query, how to create a session variable which is the instance of a COM component?<BR> <BR>global.asa<BR>---------------<BR> <BR>sub session_onstart()<BR> <BR>dim x<BR>x=server.createobject("mycom.myclass")<BR> <BR>session("obj")=x<BR> <BR>end sub<BR> <BR>Will the session variable &#039;obj&#039; be a instance of "myclass"?<BR> <BR>and can i access the method "add()" in myclass as session("obj").add()?<BR> <BR>waiting response.....<BR> <BR>regards,<BR>rajiv<BR><BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: COM Component instance in session_onstart()???

    You&#039;ll need to use the Set keyword since it&#039;s an object variable:<BR><BR>Set Session("obj") = Server.CreateObject...<BR><BR>When using it in a page it&#039;s worth setting a local variable (Set obj = Session("obj")) as local variable access is much faster than session variables.<BR><BR>One last point: is that object Free-Threaded (or Neutral-threaded under Win2K)? If it&#039;s not you&#039;ll have scalability problems from keeping it in a Session.<BR><BR>Dunc

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts