Create ASP.NET Session from Cookie Session

Is it possible to create a session from a session cookie? I have a scenario where (due to the pipeline) I have a cookie, but my ASP.NET Http Context hasn't created a Context.Session object yet. Can I do this manually by somehow referencing the cookie or its content?

+2


source to share


2 answers


As far as I know, this is not possible due to the page lifecycle. Until the lifecycle ends and a session starts, there isn't much you can do other than store the information you need in an application variable, or alternatively, write a separate cookie using HttpCookies.

I usually use the latter if I need to do something before initializing the session.



I am assuming you need to get information that is stored in a session or you need a session id

0


source


No, I don't think so, because this happens inside the SessionStateModule, and even if you try to create, you won't be able to access the actual stored variables. However, there is a Session_OnStart event where you can make your sessoin access code.



0


source







All Articles