Retrieve from Sessions using C#
Date: 07/04/06
(Asp Dot Net) Keywords: asp
Hello everyone,
I'm currently working on a ASP.NET-project where I'm trying store a collection-class in the SessionState. Adding the class to the session is not any problem but retrieving it seems to be a whole different affair, which is why I've turned here for help.
Btw, I'm using C# for this project and switching to anything else is not an option.
The collection-class is named CUser and contains three strings and one byte, along with properties for these.
After having created an instance, usrInfo, of CUser I add it to the SessionState-object by:
Session.Add("userInfo",usrInfo):
Later on I'm trying to retrieve this object and from what I've read on MSDN it should be something like this:
CUser userInfo = Session["userInfo"];
However, it doesn't work. As I understand it the object in the SessionState is having some sort of identitycrizes and I'm clueless on how to go solve this in C#.
Any help will be appreciated. :)
Edit: Problem solved! Thanks anyway...
Source: http://community.livejournal.com/aspdotnet/72240.html