Answer Posted / phani krishna
You can Kill the session mainly by two ways
1. Session.Clear():
2. Session.RemoveAll();
3. Session.Remove();
Session.Clear() & Session.RemoveAll(): both are used to
clear all the values from session But Not Session Object.
Session.Remove() is used to remove the sessions from
particular session id only.
4. Session.Abound(): this method is used to kill the object
it self, Mean you can't find the session with the session
name and it will remove the values from session.
Eg: I have a session["mysess1"]="xxx";
session["mysess2"]="yyy";
if i use the method to kill the session by the method of
Session.Abound();
You can't find any more session which is created before the
session.Abound() method.
if u try to access session["mysess1"] it give error.
If u come for Session.Clear(); & Session.RemoveAll();
this mean the values of the sessions will clear but object
will exist.
If u come for Session.Remove();
It is used to clear the values from particular session only..
eg: Session.Remove(sessionName);
It will clear the particular session name values only..
Depend on your Application Requirement you can select any
one of the way..
But don't go for Session.Abound();
Until you don't want all the sessions and it's objects in
your current application.
| Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
what cut off mark for po's,what questions they asked for interview?
What is loop in asp.net?
How is mvc different from asp.net? : Asp.Net MVC
i want the asp.net technical questions and answeres
Is asp.net a programming language?
What are the different web pages?
What is the mvc framework?
What are the Types of session management in ASP.NET
How does cookies work in asp net?
What is hidden field in asp.net?
What is the use of placeholder control?
If there are multiple update panels on the page say upd1 and upd2. There is a button placed in upd1. How can you stop upd2 to update when button placed in upd1 is clicked?
Why is string called immutable data type?
Describe the disadvantage of cookies.
Which is the parent class of the ASP.NET server control?