1

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?

1
  • How are you accessing the Session from that other thread? Commented Dec 15, 2011 at 12:05

3 Answers 3

1

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.

Sign up to request clarification or add additional context in comments.

2 Comments

It makes sense. So when I use InProc the other thread updates the same place in memory, but when using SQLServer it never serialize it to the server. So now my question would be - How can I force saving to the database or let the thread know that it should serialize the session to the database? Thanks
I had the same problem, came to a similar conclusion. But I also have not been able to find a resolution.
0

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

0

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.