Problem in Fetching Session Variable

G

Guest

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
 
B

bruce barker

be sure you are not storing the session reference in a static

-- bruce (sqlwork.com)


Phanidhar said:
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'.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,535
Members
45,007
Latest member
obedient dusk

Latest Threads

Top