|
Sunday, 05 November 2006 |
|
This code example shows how to store objects in the Session object ins ASP.NET.
You don't really need to remove objects from Session object because it only lasts during the session lifetime. However, you can remove objects by using the Session.Remove() method or the RemoveAll() method. You might want to use these two methods to conserve Web server resources, especially if you store large objects in Session. (Code in C#)
/// Saving a string to Session key 'customer'. string customerName = 'JoeSmith'; Session.Add("customer", customerName); /// Retrieving the session object. string customerName = (string)Session["customer"];
|
|
Last Updated ( Friday, 08 December 2006 )
|