In my ASP.NET application I created a custom thread. The thread is updating the session. When I am using InProc session state it works well, but when using SQLServer session state the session is not being updated. Any ideas?
3 Answers
I can't find documentation to back it up, but I think that the SqlServer session state will serialize the Session to the database at the end of the request processing. So anything that's changed after that time is ignored as a new request will get the session from the database.
2 Comments
What are doing in that process is important ? It seems that you are updating some object that stored inside session.
Now it is working with InProcess and not with Sql means you have problem with object serialization.
IF you are using some class whoes instance stored in Session that make that class serializable.
If this not help you please provide more information.
Thanks.
Comments
To see a practical example of what is going on check out this question (with example code) I posted a few days ago.
I don't think there is a way to "let the main thread know it should wait before it serializes to the data store". You just have to wait until the background thread finishes. Which kinda defeats the purpose of using the background thread in the first place.