Click here to Skip to main content
15,912,294 members
Please Sign up or sign in to vote.
2.22/5 (2 votes)
See more:
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 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>


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
Posted

1 solution

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[^]
 
Share this answer
 
Comments
ssd_coolguy 19-Sep-12 4:38am    
5++
♥…ЯҠ…♥ 19-Sep-12 4:48am    
Thanks pal
cm_Aryan 19-Sep-12 10:32am    
Thanks Buddy
♥…ЯҠ…♥ 20-Sep-12 5:11am    
always welcome pal....

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