Alternatives to Session

Session has a problem in the Web World, as based upon your Session Policy, objects could be added and built to the extent of leaving reasonable large chunks of “user objects” in memory for a large space of time.

The alternatives all leave the same problem, when you do not have an Event to indicate it is now time to DELETE the object (as more than one page may make use of it).

Here is a suggestion – CACHE object (with Expiration)

                DataTable users = new DataTable();


                if (Cache[“users”] != null)


                    // users = getUsers(customer);

                    Cache.Add(“users”, users, null, System.Web.Caching.Cache.NoAbsoluteExpiration, new TimeSpan(0, 60, 0), System.Web.Caching.CacheItemPriority.Default, null);




                    users = (DataTable)Cache[“users”];


Don't be shellfish...Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedInShare on TumblrEmail this to someone

One thought on “Alternatives to Session”

Leave a Reply