Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Content getting swapped for multiple sessions users in asp.net website

I am developing an asp.net website.

  • When two different users are accessing that website with different sessions, one users content is getting swapped to another user.
  • I am using javacsript, calling pagemethods from .aspx pages and C# at code behind.
  • This problem mainly occuring when two users are calling same functionality at a time.
  • I thought static variables could cause this problem and tried not to use any static variables or static functions except for pagemethod functions where it is manadatory for a pagemethod to be static.

please help me out with this problem.

like image 282
Hulk Avatar asked Sep 04 '13 11:09

Hulk


2 Answers

Could also be related to threading. Lock those variables up and see if that helps.

Static methods do not guarantee static variable state even though the methods are guaranteed to be thread-safe. You have to manage that state and asp.net treats static variables as shared amongst all users. See this answer from a related question.

More reading: Thread Synchronization

like image 184
TombMedia Avatar answered Sep 20 '22 21:09

TombMedia


We had a similar problem, and found that it was our loadbalancer(f5 Big-IP) that messed up the session-ids. We changed the loadbalancer to be stateful, and it now functions perfectly...

like image 36
SteinIP Avatar answered Sep 20 '22 21:09

SteinIP