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

Problem in Fetching Session Variable

P: n/a
Hi
We are developing an ASP.NET application is being accessed by multiple users simultaneously. We are facing a problem in retrieving the ASP.NET session of the logged on users correctly. Let me explain u using a code snippe

string strUsername = Session["User"]
Session objSession = GetSession(strUsername)

The above code is executed in almost all pages to fetch the user session.
When mutilple users are simulteneoulsy accessing the application, the user name retrieved from the Session is not for the current user but for someother user who is currently logged on to the system

For example, if users user1,user2, and user3 are currently logged into the system, and if I try to retrieve the APS.NET session variable for user 'user1', I sometimes get the session of either user2 or user3. This is also not consistent. If i refresh this problem is NOT observed. So in the above code snippet when i'm expecting to retrieve the session username of 'user1' using 'Session["Username"]', I get the value as either 'user2' or 'user3'

I'm not able to figure out this problem. It'll be great if someone can help in resolving the issu

Thanking you in advance

Regard
Phanidha


Nov 18 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
be sure you are not storing the session reference in a static

-- bruce (sqlwork.com)
"Phanidhar" <an*******@discussions.microsoft.com> wrote in message
news:9A**********************************@microsof t.com...
Hi,
We are developing an ASP.NET application is being accessed by multiple users simultaneously. We are facing a problem in retrieving the ASP.NET
session of the logged on users correctly. Let me explain u using a code
snippet
string strUsername = Session["User"];
Session objSession = GetSession(strUsername);

The above code is executed in almost all pages to fetch the user session.
When mutilple users are simulteneoulsy accessing the application, the user name retrieved from the Session is not for the current user but for
someother user who is currently logged on to the system.
For example, if users user1,user2, and user3 are currently logged into the system, and if I try to retrieve the APS.NET session variable for
user 'user1', I sometimes get the session of either user2 or user3. This is
also not consistent. If i refresh this problem is NOT observed. So in the
above code snippet when i'm expecting to retrieve the session username of
'user1' using 'Session["Username"]', I get the value as either 'user2' or
'user3'.
I'm not able to figure out this problem. It'll be great if someone can help in resolving the issue
Thanking you in advance.

Regards
Phanidhar

Nov 18 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.