Forums
This topic is locked
Non-Existent Cookies
Posted 07 Apr 2004 20:22:56
1
has voted
07 Apr 2004 20:22:56 Jack Cider posted:
con.CloseSet con = Nothing
Response.Cookies("whoru"("idnum" = newkey
Response.Cookies("whoru".Domain = "aaahhhh.com"
Response.Cookies("whoru".Expires = Date+365
MYMESSAGE = Server.URLEncode("Thank you for Registering with Us. You will be redirected in ten seconds."
Response.Redirect ("regthankyou2.asp?DELAY_TIME=3&DELAY_MESSAGE=" & MYMESSAGE & "&REDIRECT_URL=" & myURL & ""
This is a piece of the code for a form processor in ASP that I have. I have not gotten any error messages, and everything appears to work fine. But when I checked my browser's internet cache (IE6), the cookie was nowhere to be found. The newkey variable should be the AutoNumbered ID field from a database which the form submits to successfully. Below is the code that should be getting the ID number:
con.Execute sql_insert
sql = "SELECT @@Identity"
Set rsIdent = Server.CreateObject("ADODB.Recordset"
rsIdent.Open sql, con, adOpenForwardOnly, adLockReadOnly, adCmdText
newkey = rsIdent(0).Value
rsIdent.Close
Set rsIdent = Nothing
con.Close
Set con = Nothing
adLockReadOnly=1 and adCmdText=&H0001 (Both variables are set earlier in the code). As you can see the code setting the cookie immediately follows this code. If anyone can tell me why this cookie does not show up it would be a great help to a hapless newbie. Thanks
Jack
Replies
Replied 07 Apr 2004 22:44:00
07 Apr 2004 22:44:00 Jack Cider replied:
OK I have a slight change to my previous post. Turns out the cookie <i>is</i> being saved on my machine. I originally set my form processor to save all of the required fields (much of it personal info) in a cookie on the user's computer. I've changed that so, instead, the user will only save a cookie with the ID number that corresponds to their name in my database. I'll then use that ID number to retrieve personal info when needed. Even though the cookie is now supposed to submit only the ID number, the cookie (which I have deleted from the hard drive a couple of times now) seems to fill itself up with default info that shouldn't even be sent to it. Does anyone know why? Again, a hapless newbie would be much appreciative.
Jack
Jack