ProblemThe HTTPContext.Current.Session seems to randomly return NOTHING to me. However, on further research it seems that this is because the HTTPContext.Current.Session object is only available when there is a web session available and not any other time (duh!). I was accessing it from the Page_Load() and Page_PreRender() event hence why it look like randomly returning NOTHING to me.
Answer
That means, one cannot access the HTTPContext.Current.Sesion object from the Page_Load() event. Because at that time, it is not a session yet. You can, however, access it while in the Page_PreRender() event.
Hope this helps others.
No comments:
Post a Comment