Possible Duplicate:
ASP.NET Session size limitation
I am building a asp.net c# webforms application. I want to know whats best wrapper class do you use for session handling? And how much data can we store in session? What's limit?
You may want to check out this post-
ASP.NET Session size limitation
As for the wrapper class, there really isn't a lot you need to do. I usually find it best to have only one class accessing the session. I usually use a static property to retrieve the objects I want.
public static class MyData
{
public static MyObject Item1 {
get { return HttpContext.Current.Session["DataKey"] as MyObject;}
set { HttpContext.Current.Session["DataKey"] = value;}
}
}
Obviously you can modify the pattern as needed to auto construct the objects.
Be very careful with storing a lot of data in session. remember, session lasts as long as the person's "session" is active. you might have a server that can do 200 requests a second, but you may have 15,000 people who you are maintaining session for at the same time. Assuming you are using the default for session (which is server memory), you may quickly find your server running out of memory.
It sounds odd, but for scalability, look hard at storing stuff in cookies, and or your db.