Results 1 to 5 of 5

Thread: Global Variable Vs Session Variables

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Nov 2002
    Location
    Left past the postbox
    Posts
    30

    Global Variable Vs Session Variables

    Hi,

    Im writing a web app and so far im using global variables although im not sure this is the best way to go, is it possible while using global variables for more than one user to access the same object??


    Thanks


    Chris

  2. #2
    Member Ooogaleee's Avatar
    Join Date
    Nov 2002
    Location
    Jacksonville, FL
    Posts
    52

    Question hmmmmm....

    I'm kinda a newbie as well, so forgive the question if it's dumb; but will global variables even hold their value when a new page is loaded? You may not have any choice but to use session variables.

    I will follow to see if anyone answers your question.

    Ooogs

  3. #3
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687
    You have two sets of objects that can store data across page calls. Session variables, which are user specific, and Application variable which all sessions can see. If the data is user specific, stick with the Session. If it is something all users need to use (I've seen forum apps that store configuration data this way) then use the Application object.
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  4. #4
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    Are we talking about a variable in a Module? Is that what you mean by global variable? Also is that what you mean by Application variable, techgnome?

  5. #5
    PowerPoster Lethal's Avatar
    Join Date
    Oct 2000
    Location
    Ohio
    Posts
    2,496
    Im writing a web app and so far im using global variables although im not sure this is the best way to go, is it possible while using global variables for more than one user to access the same object??
    You have to be aware of concurrency issues when using an instance of the HTTPApplicationState object (Application). Theoretically, two pages, for instance, could access the same object from the global dictionary and make updates, canceling out the other page's update. One way around this is by using the 'Application.Lock --- Application.Unlock' methods, whenever your code makes a change to the object. However, this will adversly affect application performance and open up doors for potential deadlocks.

    But, if all your objects are readonly, then you should be fine.

Posting Permissions

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



Click Here to Expand Forum to Full Width