1, using the Session.Timeout property to set the time-out period
For a user who logs on to an ASP application, if the user does not do anything else within the default time of the system, the user's session is automatically revoked when the time is set, which prevents the system from wasting resources. The TimeOut property of the Session object can be used to set "Expiration Time" when the browser's settings in the TimeOut property are formatted as:
Session.TimeOut=MaxTime
2, Instance code: (5.asp) page, this example shows how to control the end of the session.
<% @ language="vbscript" %>
<% session.timeout=60 %>
<body>
<%
who = Session.SessionID
CurrentPage=Request.ServerVariables("SCRIPT_NAME")
Response.AppendTolog who & ":" & CurrentPage
Response.write "<center>你的会话标识为:" & who & "<p>"
Response.write "你当前访问的页面路径为:" & CurrentPage & "<p>"
if Session("I")="" then
session("i")=1
else
session("i")=session("i")+1
end if
Session.Abandon
Response.write "本页面被你刷新了" & Session("i") & "次。</centr>"
%>
4, the Code annotation
In this case, the time-out period for the session is set to 60 minutes, but each time the page is refreshed, it is forced to end this session by calling the Abandon method of the sessions object, starting a new session, and generating a new session identity.
To confirm this, open the IE browser window, and then enter the URL of the above page in its address bar, press F5 repeatedly to refresh the page, and you will see that the session ID is changing, but the page refresh times always show 1.
See the full set of ASP Getting started tutorials