By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,996 Members | 896 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,996 IT Pros & Developers. It's quick & easy.

How to protect session variables in this case?

P: n/a
Hi!

If i have an aspx page that sets a Session variable based on some input
fields and then, in Internet Explorer go to the File menu and open a new
window... the new window will be the same aspx same in the same session...
but it will overwrite the Session variable with the input made in new
window. So then if I go back to the old window and press save (have a save
button)... I will save the session Variable BUT with the values made from
the new window... that's really not good.

How do I prevent this?

I DO need session variables in my scenario so don't question that please.

best regards
/Lars
Nov 19 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
In Page_Load, if this is the first time page is loading, create a GUID, and
store it in viewstate. Then, store your actual value in session under the
key that is the GUID you generated earlier. Every time you need your session
variable, retrieve the GUID from viewstate, and use that as the key.

Each page should have its own viewstate, and thus it's own different GUID.

"Lars Netzel" <tr*****@apa.se> wrote in message
news:uv****************@TK2MSFTNGP11.phx.gbl...
Hi!

If i have an aspx page that sets a Session variable based on some input
fields and then, in Internet Explorer go to the File menu and open a new
window... the new window will be the same aspx same in the same session...
but it will overwrite the Session variable with the input made in new
window. So then if I go back to the old window and press save (have a save
button)... I will save the session Variable BUT with the values made from
the new window... that's really not good.

How do I prevent this?

I DO need session variables in my scenario so don't question that please.

best regards
/Lars

Nov 19 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.