PDA

Click to See Complete Forum and Search --> : Cookie error: Who can help?


jesus4u
Feb 20th, 2001, 09:02 AM
When a user enters on the registration page I am setting cookies at the top of my html as follows:

<%Response.Cookies("ReclaimAmerica").Expires = Date+365
Response.Cookies("ReclaimAmerica").Secure = FALSE
Response.Cookies("ReclaimAmerica")("FirstName") = name1.value
Response.Cookies("ReclaimAmerica")("LastName") = name.value
Response.Cookies("ReclaimAmerica")("EmailAddress") = Session("NewUserEmail")


Error Type:
Microsoft VBScript runtime (0x800A01A8)
Object required: 'name1'

My name1 is the name I assigned to the textbox.

What is the error looking for? What is the object?

Jerry Grant
Feb 20th, 2001, 10:39 AM
You must have a form object also:

<html>
<body>
<form name="oForm" method="post">
<Input type="text" name=oName></input>
</form>
</body>
</html>

when you reference the object use:

Response.Cookies("ReclaimAmerica")("FirstName") = oForm.oName.Value

OK :cool:

jesus4u
Feb 20th, 2001, 10:55 AM
Thanks it works!

Now when I try display the user's name on another screen it also works

BUT

if I leave the site and then come back the cookie has stopped displaying the information previously stored.
When I look into the cookie the values are gone!

How do I preserve the values from being destroyed?

Jerry Grant
Feb 21st, 2001, 02:57 AM
I assume you have cookies enabled in IE?
Try to use an expiry date as follows:
<%
Response.Cookies("ReclaimAmerica").Expires = DateAdd("m", 12, Now())
%>
I'm not sure the syntax you have used is valid.
:cool: