Click here to Skip to main content
15,891,621 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have create a website in that chat functionality is there
i want if a user do not logout
a entry should go in database whether he close browser or page is iedal for sometime.
automaticalyy logout
Posted

1 solution

In Session
Specifies the number of minutes that a session can remain idle before the server terminates it automatically. The default is 10 minutes. Session.Timeout has no hard-coded limit. Most Web administrators set this property to 8 minutes. It should not be set higher than 20 minutes (except in special cases) because every open session is holding onto memory. It should also not be set lower than 4 minutes because clients rarely respond within that time resulting in a loss of session state.
XML
<configuration>
  <system.web>
     <sessionState timeout="20"></sessionState>
  </system.web>
</configuration>


If the user does not refresh or request a page within the time-out period, the session ends.
And check if session is null in MasterPage load event
if(Session["UserID"]==null)
Response.Redirect("Login.aspx");


User
XML
HTML <meta> Tag

While being able to reload the current page is useful, it is not typically what people want from the meta refresh tag. To redirect to a new page, the syntax is nearly the same as reloading the current page:
<meta http-equiv="refresh" content="600"> 

content="600"—This is the amount of time, in seconds, until the browser should reload the current page.this time it will redirect to login page if session in null
Get MoreInfo
redirect-meta-refresh.phtml[^]
 
Share this answer
 
v2

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