Login | Register  

Methods of Session Object

by Scud   Tuesday, February 05, 2008 Rating:
 Vote this news:


Session object is a very useful helper to store and track information for web clients. When you've create a session object, a cookie will be sent to client's browser and thsi will be used to store data. Session object contains three methods: Abandon, Contents.Remove and RemoveAll

Abandon Method 

This method deletes session. Stored information keeps in memory until all script page work. After reloading or browsing to another page, all data lost. So you may use this method on first line of page and can access over same scope.

<% 

session("username") ="demo@demo"

session.abandon 

.... blah blah .....

response.write  session("username")

%> 

Still we can call existing session here, but after browsing all data will be gone.

Contents.Remove & Contents.RemoveAll 

Simply this method deletes an/all item(s) from the contents collection. Similiar usage can be used for Application object.

<%

session("username") ="demo@demo"

Session.Contents.Remove("username")

%> 

Using RemoveAll method we can delete more than one session variable.

<%

Session.Contents.RemoveAll()

%> 

 





Dotnetindex.com is listed with 411asp.net
Dotnetindex.com is listed with aspin.com
Dotnetindex.com is listed with jspin.com
PHP, ASP, .NET, JSP Resources, Reviews







page counter
Copyright © 2007 Powered by GNews Publisher Positive. All rights reserved. Contact Us - Load Time: 0.03 second(s)