DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Declaring Session-scope object variables in ASP

  1. #1
    Biswa Guest

    Declaring Session-scope object variables in ASP


    Can anybody tell me if there is any functional/implementation-related/execution-related
    DIFFERENCE between these two methods of declaring Session-Scope Object variables
    in ASP?

    Method #1:
    ----------

    <In Global.ASA or anywhere else, within ASP tags>
    <Script Snip>

    Dim objDictObject
    Set objDictObject = Server.CreateObject("Scripting.Dictionary")

    '....(populate the object and persist it with Session Scope)
    Session("MyStore") = objDictObject
    Set objDictObject = Nothing

    <End Script Snip>

    Method #2:
    ----------
    <In Global.ASA, USING HTML <OBJECT> Tag>
    <OBJECT ID = "MyStore" RUNAT="SERVER" SCOPE="SESSION" PROGID="Scripting.Dictionary"></OBJECT>

    Any enlightenment will be appreciated.
    Thanks in advance.

    Biswa.

  2. #2
    Russell Jones Guest

    Re: Declaring Session-scope object variables in ASP

    The difference is that you can reference the MyStore object created using
    the <object> tag without the extra syntax of Session("MyStore") required if
    you populate the Session variable as in your Method #1 example. With that
    said, I hope you're not doing either one, because you should *never* store
    apartment threaded objects at either Application or Session scope. For a
    possible solution see:

    http://www.devx.com/upload/free/feat...400/id0400.asp


    "Biswa" <B_Bandyopadhyay@hotmail.com> wrote in message
    news:3b80af02$1@news.devx.com...
    >
    > Can anybody tell me if there is any

    functional/implementation-related/execution-related
    > DIFFERENCE between these two methods of declaring Session-Scope Object

    variables
    > in ASP?
    >
    > Method #1:
    > ----------
    >
    > <In Global.ASA or anywhere else, within ASP tags>
    > <Script Snip>
    >
    > Dim objDictObject
    > Set objDictObject = Server.CreateObject("Scripting.Dictionary")
    >
    > '....(populate the object and persist it with Session Scope)
    > Session("MyStore") = objDictObject
    > Set objDictObject = Nothing
    >
    > <End Script Snip>
    >
    > Method #2:
    > ----------
    > <In Global.ASA, USING HTML <OBJECT> Tag>
    > <OBJECT ID = "MyStore" RUNAT="SERVER" SCOPE="SESSION"

    PROGID="Scripting.Dictionary"></OBJECT>
    >
    > Any enlightenment will be appreciated.
    > Thanks in advance.
    >
    > Biswa.




Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center