how to kill session while closing browser

Posted by Swaroopa under ASP.NET on 7/3/2012 | Points: 10 | Views : 20216 | Status : [Member] | Replies : 9
Hi ,

how to kill session while closing browser or unexpectedly closed.

Swaroopa


Responses

Posted by: Savari_Arm on: 7/3/2012 [Member] Starter | Points: 25

Up
0
Down
ya
it will help you. ... Session.Abandon() this will destroy the the session


Swaroopa, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: perfectchourasia-9163 on: 7/4/2012 [Member] Starter | Points: 25

Up
0
Down
Session.Abandon();
Session.Expire();
Session.clear();

ER sandeep chourasia
sandeepchrs@yahoo.com (on facebook)
http://www.aspnetcodes.com/

Swaroopa, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Swaroopa on: 7/4/2012 [Member] Starter | Points: 25

Up
0
Down
hi,

I know abt this , but whr can i write this.
Generally when am click on logout button their can write this, while closing browser where should can we write.

Swaroopa

Swaroopa, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: perfectchourasia-9163 on: 7/4/2012 [Member] Starter | Points: 25

Up
0
Down
yes write it in logout button click.To delete all session before closing

ER sandeep chourasia
sandeepchrs@yahoo.com (on facebook)
http://www.aspnetcodes.com/

Swaroopa, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Swaroopa on: 7/4/2012 [Member] Starter | Points: 25

Up
0
Down
Hi sandeep,

i hope your doing well.

we are developing one website that is related to jobportal and we need to give login limit for employers.
suppose one employer opened website and closed application with out click logout button, in that time how to kill session.



Swaroopa

Swaroopa, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Savari_Arm on: 7/4/2012 [Member] Starter | Points: 25

Up
0
Down
hi
when ever u want to kill the session in the user defined place .
so you want to kill the session in your logout button ....
enter into code behind in logout button and write session.abondan();

Swaroopa, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: perfectchourasia-9163 on: 7/4/2012 [Member] Starter | Points: 25

Up
0
Down
<system.web>
<sessionState mode="InProc" cookieless="false" timeout="15">
</sessionState>
</system.web>


http://csharpdotnetfreak.blogspot.com/2011/12/set-session-timeout-in-aspnet-webconfig.html

Check the link three ways of set timeout by default.

ER sandeep chourasia
sandeepchrs@yahoo.com (on facebook)
http://www.aspnetcodes.com/

Swaroopa, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Patel28rajendra on: 7/5/2012 [Member] Starter | Points: 25

Up
0
Down

Posted by: Patel28rajendra on: 7/5/2012 [Member] Starter | Points: 25

Up
0
Down
Hi


Here is the answer of you Question check it is Very Short

http://stackoverflow.com/questions/287022/closing-the-browser-should-actually-clear-the-session-variables-an-asp-net-sessi

R D Patel

Swaroopa, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response