经典ASP中不会破坏种子变量 [英] Seesion Variables not destroying in Classic ASP

查看:70
本文介绍了经典ASP中不会破坏种子变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



当我在Classic ASP中使用Sessions时,我检查了会话超时后会话变量没有被破坏.以下是我的代码

ASP代码

Hi,

When i am working with Sessions in Classic ASP, I checked that session variables are not destroying after the session TIMEOUT. Below is my Code

ASP Code

<%
Dim sessid, Uname
Session.Timeout = 1
sessid=Session.Sessionid
Response.write(sessid)
Session("Uname")=Request.Form("uname")
uname= Session("Uname")
response.write(uname)
Response.Write("The timeout is:" & Session.Timeout)
%>



HTML代码



HTML Code

<!DOCTYPE html>
<html>
<body>
	<h1> user Login form</h2>
	<form method="post" action="vbscript.asp">
		<label>username: </label> <input type="text" id="uname" value="" name="uname" />
		<label>password: </label> <input type="text" id="pwd" value="" name="pwd" />		
		<input type="submit" id="login_btn" value="Login" />
	</form>
</body>
</html>



最初,我将Session.Timeout设置为1.尝试刷新vbscript.asp页面2分钟后,我仍然能够看到相同的session("Uname")值,必须将其销毁.

如果我对Sessions Concept的理解不正确,可以请您澄清一下.实际上,我是Classic ASP的新手



Initially i set Session.Timeout to 1. After 2 minutes when i try to refresh vbscript.asp page i am still able to see the session("Uname") value same, which has to be destroyed.

Can you Clarify me on this if i am wrong about Sessions Concept. Actually I am new to Classic ASP

推荐答案

嗨Aryan,

似乎您只是通过设置Session.Timeout = 1选项让应用程序在1分钟后过期,这很好,但是您没有清除会话变量.

您应该在Global.asa文件的 Session_OnEnd 方法中清除会话变量.

希望这可以帮助您解决问题.
请参考此链接 [
Hi Aryan,

It seems that you are just letting your application should expire after 1 min by setting the Session.Timeout = 1 option, fine but you are not clearing the session variable.

You should clear the session variable in Session_OnEnd method in Global.asa file.

I hope this would help you to resolve the issue.
Please refer this link[^]


这篇关于经典ASP中不会破坏种子变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆