我想在 1 分钟后自动销毁会话。但 session.timeout 对我不起作用。请查看我的代码。
创建.asp
<%
Session.Contents.RemoveAll()
Session("page") = "Active"
Session.timeout = 1
Response.Redirect "time.asp"
%>
时间.asp
<%
Response.Write(Session("page"))
if Session("page") = "Active" then
Response.Write( "Session is Active,This Page will Expire After 1 mintue ")
%>
<h2> Time Out: <span id="timerLabel" runat="server">65</span> </h2>
<script type="text/javascript">
function countdown()
{
seconds = document.getElementById("timerLabel").innerHTML;
if (seconds > 0) {
document.getElementById("timerLabel").innerHTML = seconds - 1;
setTimeout("countdown()", 1000);
} else { location.reload(); }
}
setTimeout("countdown()", 1000);
</script>
<% else %>
<a href='create.asp'> Click Here to Create Session </a>
<% End if %>