|
-
Jan 6th, 2003, 11:24 AM
#1
Thread Starter
Junior Member
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
-
Jan 6th, 2003, 12:32 PM
#2
Member
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
-
Jan 6th, 2003, 01:05 PM
#3
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.
-
Jan 6th, 2003, 01:48 PM
#4
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?
-
Jan 7th, 2003, 12:21 AM
#5
PowerPoster
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|