Click to See Complete Forum and Search --> : session variable
gigsz
02-19-2007, 01:45 AM
quick question. is session variables shared among diff web pages?
example if you open 2 pages and both pages modify the session variable, will conflict occur?
tnx =)
russell
02-19-2007, 08:54 AM
yes. shared among pages, but user specific. in other words two concurrent users get their own session variables, but those are shared by all pages. in case of opening two pages by same user, last one wins.
gigsz
02-19-2007, 09:14 PM
does this mean that session variables are not safe in scenarios like this? is there a workaround for this?
tnx =)
russell
02-19-2007, 10:21 PM
they should be safe. what are u trying to do?
gigsz
02-19-2007, 10:37 PM
i have a page that get's a session variable, say 'a'. then do some manipulation in 'a'. my concern is if i open about 2 of that page, then both have some manipulation in variable 'a', will this cause a problem?...
make sense? not really good at explaining... =)
tnx
russell
02-19-2007, 10:57 PM
whether or not it's a problem depends on what happens to the variable and how atomic u need it to be. last page to modify the var will win. it is possible to use a combination of session and cookies to disallow further processing if 2 windows are open to same login. so if your app requires one window only...
gigsz
02-20-2007, 12:00 AM
kk... thanks.. =)