Wednesday, September 2, 2009

What method do you use to explicitly kill a user Session

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

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

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("MyName") = "Mary"

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

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

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.

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

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

The following example removes all items that have been added to the Session.contents collection:

Share This!


Anonymous said...

Amiable fill someone in on and this fill someone in on helped me alot in my college assignement. Gratefulness you as your information.

Anonymous said...

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.

Anonymous said...

Sorry for my bad english. Thank you so much for your good post. Your post helped me in my college assignment, If you can provide me more details please email me.

Powered By Blogger · Designed By Seo Blogger Templates