Hi please am am using session variables in my login page to transfer user data to another page but when two people try to log in at the same time one users session is overwritten by another there by two users having the same user content when their page
loads. Am using Inproc mode in a web farm hosted on godaddy windows hositng. some times in the course of browsing a user session value is replace by another user, please i need help urgently on this. I have enable session state in the page that needs to write
values into session variable and made pages that read sesion values readonly for enable sessionstate page directive. Because of this some times my session timeout even before the time set in the web.config
Are you doing anything silly such as storing the value from the Session object into a static/shared property/field. Are you using any static/shared methods?
You're quite correct. It shouldn't happen. The fact that it is would tend to imply that you have a bug in your code, and it is most likely caused by using shared state.
Regards
Dave
Marked as answer by Qi Wu - MSFT on Feb 23, 2012 01:29 PM
hi.....just make user user id unique...it will work fine...user name may same so use user id ...
A.Venkatesan
Microsoft Certified Professional
Please mark the replies as answers if they help or unmark if not.
If you have any feedback about my replies, please contact venkatmca008@gmail.com
User ID has absolutely nothing whatsoever to do with Session. Session is a completely orthogonal concept to user id.
There's one other thing that you should check: caching. If you say that one user is seeing another user's data, then it might be that you have caching turned on for a page, and you're not varying the content based on the session.
Regards
Dave
Marked as answer by yusif22 on Mar 06, 2012 11:25 AM
Web Farms are used for load balancing and the session id may be generated from one server and the subsequent request is processes on the other server, which leads to your problem!
You can also consider StateServer mode incase of WebFarm. It is more reliable!
i had enable caching in the page and that was causing the problem, thanks very much for ur help and i appreciate it a lot, can u give me ur facebook name so that i can chat with u.
yusif22
Member
21 Points
16 Posts
session variable overwritten
Feb 16, 2012 07:58 AM|LINK
Hi please am am using session variables in my login page to transfer user data to another page but when two people try to log in at the same time one users session is overwritten by another there by two users having the same user content when their page loads. Am using Inproc mode in a web farm hosted on godaddy windows hositng. some times in the course of browsing a user session value is replace by another user, please i need help urgently on this. I have enable session state in the page that needs to write values into session variable and made pages that read sesion values readonly for enable sessionstate page directive. Because of this some times my session timeout even before the time set in the web.config
sanjayjgoswa...
Member
122 Points
31 Posts
Re: session variable overwritten
Feb 16, 2012 08:42 AM|LINK
Hay It is not possible
Session["UserDetails"] = "sanjay";
Session always create diffrent for diffrent user.
With Internet Explorer must be new instantat insted of other tab.
Session is share between tab .
yusif22
Member
21 Points
16 Posts
Re: session variable overwritten
Feb 16, 2012 08:51 AM|LINK
it is happening do not doubt it and i myself is confused
DMW
All-Star
15943 Points
2353 Posts
Re: session variable overwritten
Feb 20, 2012 12:05 PM|LINK
Are you doing anything silly such as storing the value from the Session object into a static/shared property/field. Are you using any static/shared methods?
You're quite correct. It shouldn't happen. The fact that it is would tend to imply that you have a bug in your code, and it is most likely caused by using shared state.
Dave
venkatmca008
Participant
1810 Points
341 Posts
Re: session variable overwritten
Feb 20, 2012 12:12 PM|LINK
hi.....just make user user id unique...it will work fine...user name may same so use user id ...
Microsoft Certified Professional
Please mark the replies as answers if they help or unmark if not.
If you have any feedback about my replies, please contact venkatmca008@gmail.com
DMW
All-Star
15943 Points
2353 Posts
Re: session variable overwritten
Feb 21, 2012 07:46 AM|LINK
User ID has absolutely nothing whatsoever to do with Session. Session is a completely orthogonal concept to user id.
There's one other thing that you should check: caching. If you say that one user is seeing another user's data, then it might be that you have caching turned on for a page, and you're not varying the content based on the session.
Dave
roopeshreddy
All-Star
20155 Points
3328 Posts
Re: session variable overwritten
Feb 21, 2012 03:10 PM|LINK
Hi,
Since you are using WebFarm, you can't use InProc Session! If you have use InProc mode, then check the Sticky sessions!
http://wiki.asp.net/404.aspx?aspxerrorpath=/themes/fan/pages/page.aspx/1248/aspnet-and-load-balancing/
Web Farms are used for load balancing and the session id may be generated from one server and the subsequent request is processes on the other server, which leads to your problem!
You can also consider StateServer mode incase of WebFarm. It is more reliable!
Hope it helps u...
Roopesh Reddy C
Roopesh's Space
yusif22
Member
21 Points
16 Posts
Re: session variable overwritten
Mar 06, 2012 11:30 AM|LINK
i had enable caching in the page and that was causing the problem, thanks very much for ur help and i appreciate it a lot, can u give me ur facebook name so that i can chat with u.