views:

216

answers:

2

Hello, is it possible to instantiate a session from a session cookie? I have a scenario, where (due to pipeline) I have the cookie available, but I my ASP.NET Http Context did not construct the Context.Session object yet. Can I do this manually, referencing the cookie or its contents somehow?

A: 

As far as I am aware this is not possible due to the page lifecycle. Until the lifecycle completes and initaties the Session there isn't much you can do, apart from either storing the information you need in an Application Variable, or alternatively writing a seperate cookie using HttpCookies.

I normally use the latter if I need to do something before the Session is initialized.

I am assuming you need to get information which is stored in the Session or requires the Session Id

Diago
A: 

No I dont think because it happens inside SessionStateModule and even if you try to create you will not get access to actual variables stored. However there is Session_OnStart event where you can do your sessoin access code.

Akash Kava