6 March 2014

session variables in asp.net

Using session in asp.net is one of the server side state management technique. This maintains state specific to the user and all the session gets destroyed after the application is closed.

1. To declare a session in c#
Session ["yourvariablename"]="value"

2. To clear a value holded by any session variable we can use 
Session.clear() or session.removeall()

3. To dispose a session I.e. to destroy the session along with value. Here the session variable will exist no more till it is declared with the same name.
Session.abandon()

4. To remove a specific session Use this 
Session.remove("sessionvariablename")

No comments:

Post a Comment