After having a chat with a colleague i'm interested to know if anyone has done any research/tests to see the most efficient and recommended ways of storing data in the asp.net session.
I recently stumbled across this question: How to access session variables from any class in ASP.NET? and started to use that technique (creating my own session class to give me the advantage of intellisense and prevent the need for explicit casting when retrieving data from the session).
However, it has been suggested that the data in my object is being serialised into a string and then stored... then de-serialised when being retrieved and this may not be very efficient.
For example... If I want to load the user's current permissions and store them in the session; I might have a property within my session object defined as List<int> user_permissions
then on each page I can if (session_class.user_permissions.contains(7))
Alternatively, I could store directly in the session as a string something like; HttpContext.Current.Session["user_permissions"] = "[1][4][8][12]"
then on each page I can check HttpContext.Current.Session["user_permissions"].contains("[7]")
Which option would be more efficient and is it possible to quantify?