Reputation: 2187
I've got, probably, a very basic question about sessions. In the page load function i have the following code:
Session["loggedInUserId"] = userId;
Now the question is: if this code is on a server and two users connect to this server and log in one after another, would the one that logs in second be logged in already as the first user?
Do i need multithreading?
Upvotes: 2
Views: 67
Reputation: 13670
A session is per-browser state management. A unique session ID is stored in a cookie for that browser. Never store sensitive information in a session since the session ID is sent back and forth in plain text and thus could be used by an outside source.
Read more about Sessions here.
Upvotes: 0
Reputation: 44595
Asp.net session is per browser session. two browsers in same machine or two users in two separate machines will be referencing different sessions so dont worry.
Upvotes: 1
Reputation: 9680
Not needed. Please go through ASP.NET Session State (MSDN) post.
According to this
ASP maintains session state by providing the client with a unique key assigned to the user when the session begins. This key is stored in an HTTP cookie that the client sends to the server on each request. The server can then read the key from the cookie and re-inflate the server session state.
Hope this is what you are looking for.
Upvotes: 1
Reputation: 4129
if your are setting userId
variable as static then it will be possibe other wise there will be no problem
Upvotes: 1