Forum Moderators: open
First, should my code be in my form page or my asp page to tell the system to store the cookies if the checkbox is checked? I currently have it on my asp page that processes my form.
The code I have is:
If Request.Form("cbxcook") = "checkbox" Then'
Response.Cookies("ckusername") = Request.Form("username")
Response.Cookies("ckusername").Expires = #1/1/2010#
Response.Cookies("ckPassword") = Request.Form("password")
Response.Cookies("ckPassword").Expires = #1/1/2010#
End If
cbxcook being my name of my checkbox.
IF I run this asp I do not receive any error messages at all.
Than I run a separate asp page with this code to pull up the store cookies:
<%
Name = Request.Cookies("ckusername")
%>
<HTML>
<BODY>
Hi there <%=name%>!
</BODY>
</HTML>
Is my error on my asp page generating the cookies, or the asp page reading the cookies?
BTW, cookie for a password not a good idea. Here's a thought - Use that randomize autonumber feature in access. After you stuff in the username and password on registration, it will create a random number.
When a user logs in, grab that random number and set that as a cookie for the session. Makes looking up their info a snap, and you don't store their username and password in their cookie file.
Oh -
If Request.Form("cbxcook") = "checkbox" Then'
If there's really a ' at the end of that line, remove it :-)
Remember that IE has privacy settings and looks for a P3P policy if security levels are set to do so.
After you post to your ASP page, look at the bottom of the IE browser window and see if there's a red No Entry symbol. If there is, click it and tell IE to allow cookies for that site. Then try again. That should tell you if your code is all good. P3P is a can of worms, but you will probably need it to guarantee that your end users can log in.
but if you must...try something like this, see if it works:
With Response
.Cookies("User")("username") = username
.Cookies("User")("password") = password
.Cookies("User").Domain = "www.example.com"
.Cookies("User").Expires = "1/1/2006
End With
then on another page:
<%=Request.Cookie("User")("username")%>
If that doesn't work, make sure your server supports ASP :)
Chip-