I needed to inspect all of my existing Session Variables and finally found a sweet way...
for (int i = 0; i < Session.Contents.Count; i++)
{
Response.Write(Session.Keys[i] + " - " + Session[i] + "
");
");
}
But then I realized, this works fine in the Code behind file--which solves my problem.
However, I was initially trying to access the Session object from a Business Logic Layer, and I did not see Session object available at that level. For example, in my BLL whenever I type in Session, the intellisense no longer gives me Session.Add, Session.Contents, etc.
So, it got me wondering if there is a way that I can access Session from someplace other than .aspx? I looked at the various System includes and those didnt have any bearing on this issue.
I was hoping to have a BLL.Global.ClearSessionDataSetVars() that could be called from multiple places.
and then I found HttpContext.Current.Session
Now all is well...
However, I was initially trying to access the Session object from a Business Logic Layer, and I did not see Session object available at that level. For example, in my BLL whenever I type in Session, the intellisense no longer gives me Session.Add, Session.Contents, etc.
So, it got me wondering if there is a way that I can access Session from someplace other than .aspx? I looked at the various System includes and those didnt have any bearing on this issue.
I was hoping to have a BLL.Global.ClearSessionDataSetVars() that could be called from multiple places.
and then I found HttpContext.Current.Session
Now all is well...
No comments:
Post a Comment