Click here to Skip to main content
15,886,873 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello to all
can i kill the session when the internet disconnect or when time out
Posted

Hi!! Use this

C#
Session.RemoveAll();
           Session.Abandon();


or check this link

http://forums.asp.net/t/1594193.aspx/1[^]
 
Share this answer
 
Comments
ahmed hussein khazal 23-Feb-13 4:05am    
are this statement
Session.RemoveAll();
Session.Abandon();
kill session when the internet disconnect or only in press the button that contain this statement
Session.RemoveAll();
Session.Abandon();
[no name] 23-Feb-13 4:12am    
As we know, HTTP is a stateless protocol, the browser doesn't keep connecting to the server. It's not possible to tell the server that the browser is closed.

I think you may try an alternative option.

1. Set the timeout of session to a very small value, say 1 minute.

2. Add a hidden iframe to every page, it will access the server at a interval shorter than 1 minute

As a result, if a browser is closed no matter how, its session will be expired in a minute.
[no name] 23-Feb-13 4:14am    
Hi check this link and read the article!!! it will help you
http://forums.asp.net/p/1153888/1891072.aspx
 
Share this answer
 
use
Seassion.abandon()
FormsAuthentication.Signout()
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900