I have been using Umbraco for about a year now and have always noticed and been perplexed about how c sharp objects persist between page loads. Recently, a particular object that is not static is being overwritten by other sessions, therefore showing data for other user's sessions in the wrong session. I have been Googling this for hours to try to figure out how to prevent this object from being overwritten between sessions to no avail. I also tried saving the object by serializing and sticking in a unique cache space per user, but this still does not prevent this object from being overwritten between sessions. Another consideration I am looking at is that I am sharing a single ADO connection for the page lifecycle, so I am wondering if perhaps it is a database connection issue. I am using MARS connection. Does anyone have any advice for me on how to prevent this from happening?
Thanks for responding, I narrowed it down to the object, not the database connection. I can reproduce the following scenario. Two users access a web page at around the same time and they each receive the others data from an object that identifies who they are in the system. Not exactly sure what is causing this issue, but definitely unnacceptable. This object is binary serialized and stored in session, so on page load, the session variable is deserialized back out to the object. When stored in session, it is stored with a key of the user id, which is gauranteed to be unique. I think it may be how I am deserializing the object, which is happening in a method of itself. I will try moving this out of the class to see if I can reproduce the issue.
Object overwritten by different session
I have been using Umbraco for about a year now and have always noticed and been perplexed about how c sharp objects persist between page loads. Recently, a particular object that is not static is being overwritten by other sessions, therefore showing data for other user's sessions in the wrong session. I have been Googling this for hours to try to figure out how to prevent this object from being overwritten between sessions to no avail. I also tried saving the object by serializing and sticking in a unique cache space per user, but this still does not prevent this object from being overwritten between sessions. Another consideration I am looking at is that I am sharing a single ADO connection for the page lifecycle, so I am wondering if perhaps it is a database connection issue. I am using MARS connection. Does anyone have any advice for me on how to prevent this from happening?
Thanks!
Don
Could you explain what session you're talking about? I've never had any problems, but I use a normal connection. Why do you use a MARS connection?
Jeroen
Thanks for responding, I narrowed it down to the object, not the database connection. I can reproduce the following scenario. Two users access a web page at around the same time and they each receive the others data from an object that identifies who they are in the system. Not exactly sure what is causing this issue, but definitely unnacceptable. This object is binary serialized and stored in session, so on page load, the session variable is deserialized back out to the object. When stored in session, it is stored with a key of the user id, which is gauranteed to be unique. I think it may be how I am deserializing the object, which is happening in a method of itself. I will try moving this out of the class to see if I can reproduce the issue.
is working on a reply...