I built a strongly typed session object that looks like this:
class MySession
{
public string UsedID {get;set;}
public List<int> ListOfInt {get;set;}
public List<string ListOfString {get;set;}
.....
}
I'm currently using InProc session so when a page loads, I write:
MySession TheSession = Session["UserSession"] as MySession;
and then later in the code I can access each property with TheSession.XYZ
syntax.
This is really cool but I'm thinking that it might be better to store the session in the DB.
I'm thinking about serializing the MySession object in a json string and store the string in a DB that I can retrieve and deserialize when a page loads.
Is this a good way to do it?
Thanks for your suggestions.