Print Page | Close Window

need help in cookie in storing userName

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Classic ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
URL: https://forums.webwiz.net/forum_posts.asp?TID=16545
Printed Date: 29 March 2026 at 1:57pm
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: need help in cookie in storing userName
Posted By: thebmwz4
Subject: need help in cookie in storing userName
Date Posted: 14 September 2005 at 1:06am
hi all, i wrote a code to store the user's username as a cookie so as he need not key in his username in his next log in. but yet, my system is unable to record it as a cookie. can anyone help? thanks.
 
this is the code where i try retrieve his cookie username in his textbox for keying in his username

<input type="text" name="Name" size="20" maxlength="15" value="<%=Request.Cookies("Savelogin")%>" >

 

ths is the code for him to check the checkbox to save his username as a cookie

<input type="checkbox" name="Savelogin" >Save Login as a cookie?

Next, the form will be submitted to another page for processing
if (confirm('Press OK to proceed, otherwise Cancel to go back')){document.confirmUser.method = 'post';
document.confirmUser.action='loginConfirm.asp';
document.confirmUser.submit();}
 
 
this is the code in the next page"loginConfirm.asp"

<%

dim strEmail

if request.queryString("cookie")=1 then

strEmail=request.cookies("savelogin")("Name")

else

strEmail=request.form("name")

end if

'name of cookie is Savelogin
Dim cookieSaved
if request.form("Savelogin")="on" then
response.cookies("Savedlogin")("Name")=request.form("name")
response.cookies("Savedlogin").Expires=Date+3
cookieSaved=True
else
cookieSaved=False
end if
%>
 
 
 



Replies:
Posted By: ljamal
Date Posted: 14 September 2005 at 6:27pm
Change
<input type="text" name="Name" size="20" maxlength="15" value="<%=Request.Cookies("Savelogin")%>" >
to
<input type="text" name="Name" size="20" maxlength="15" value="<%=Request.Cookies("Savelogin")("name")%>" >


-------------
L. Jamal Walton

http://www.ljamal.com/" rel="nofollow - L. Jamal Inc : Web/ Print Design and ASP Programming


Posted By: thebmwz4
Date Posted: 14 September 2005 at 7:53pm
hi ljamal! thanks! its works successfully. thanks.



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net