DotNet Academy of Rajesh Rolen

Solutions by Rajesh Rolen

What method do you use to explicitly kill a user Session

by using Session.Abandon we can kill a user session.

Abandon
The Abandon method destroys all the objects stored in a Session object and releases their resources. If you do not call the Abandon method explicitly, the server destroys these objects when the session times out.
Syntax Session.Abandon

Remarks
When the Abandon method is called, the current Session object is queued for deletion, but is not actually deleted until all of the script commands on the current page have been processed. This means that you can access variables stored in the Session object on the same page as the call to Abandon, but not in any subsequent Web pages.
For example, in the following script, the third line prints the value Mary. This is because the Session object is not destroyed until the server has finished processing the script.
<%
Session.Abandon
Session("MyName") = "Mary"
Reponse.Write(Session("MyName"))
%>

Contents.Remove
The Remove method deletes a specific item from the Session object's Contents collection.
Syntax
Session.Contents.Remove( Item|Index )

Parameter
Item - The name of the member to remove from the collection.
Index - The index entry for the member to remove from the collection.

Remarks
The Contents.Remove method takes either a string or an integer as an input parameter. If the input parameter is a string, the method will search the contents collection for an item with that name and remove it. If the input parameter is an integer, the method counts that number of items from the start of the collection, and removes the corresponding item.

Example
The following example adds and removes a variable called myName to the Session.Contents collection.
<%
Session("myName") = " "
Session.Contents.Remove("myName")
%>

Contents.RemoveAll
The RemoveAll method deletes all items that have been added to the Session object's Contents collection.
Syntax
Session.Contents.RemoveAll ()

Example
The following example removes all items that have been added to the Session.contents collection:
<%Session.Contents.RemoveAll()%>

1 comments:

Anonymous March 22, 2010 at 11:22 PM  

Understandably your article helped me very much in my college assignment. Hats afar to you enter, will look forward in behalf of more interrelated articles promptly as its anecdote of my pet subject-matter to read.

Post a Comment

About this blog

Blog Archive

My Blog List

Advertise On This Site

Site Info

Advertise on this Site

To advertise on this site please mail on RajeshRolen@gmail.com

Information Source

About

Pages

Dot Net Academy

Advertis in This Area of Site

Powered by Blogger.

Followers

Blog Archive

Search This Blog