How to get session data without HttpContext.Current, by SessionID

I am looking for a way to read and write session data , but with no HttpContext . Current .

Why did I win this? because I want to do some actions with a user session after the page has been closed and unloaded.

For example, loading the user and viewing the page, then I create a stream to take some action and allow the user to go. Inside this thread, I like to read session data, but in this case HttpContext . Current no longer exists.

So, there is a way to read the session data, knowing only the session identifier.

I store the session inside the SQL server and I see them. him there on the table ASPStateTempSessions :)

How can I read them "offline" and manipulate them?

Thank you for the advanced.

+4
session session-variables session-state
May 05 '10 at 8:18
source share
2 answers

It is still not entirely clear why you might want to do this, but in fact you do not need to do this on Session_End (). At this point, it may be too late for you to work with session data (I have read some articles before). What might be the best solution is to actually try to work with session data when your application really has context.

For example:

There is nothing that could stop your application creating an asynchronous request in a new thread in the background (or even another application, for example, a Windows service) when the required session variable is updated or has been set, Thus, your application will be able to access to the current HttpContext, as well as to all session data.

Not sure if this helps, but it was worth it;)

Richard.

0
May 05 '10 at 15:40
source

I might be a little late, but ... Today I found about: System.Web.HttpRuntime.Cache

I know this is not the same as a session, but I think it is much better than db. Regards.

0
Dec 03 '10 at 19:25
source



All Articles