Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can't get my cookies to work

Status
Not open for further replies.

codefinger

Programmer
Feb 2, 2002
14
US
IN DEFAULT.ASP

Sub window_onload

Dim ls_cookie

ls_cookie = &quot;<%=Request.Cookies(&quot;username&quot;)%>&quot;

frmAR.textuserid.innerText = ls_cookie



End Sub

..Allows user to submit a form to DIRECTOR.ASP, which
contains the following:



<%@ Language=VBScript%>

<%


Response.Buffer = true

Response.Expires=0

Response.Cookies(&quot;username&quot;) = Request.Form.Item(&quot;textuserid&quot;)

Response.Redirect Request.Form.Item(&quot;radionewcheck&quot;)


%>


My cookies don't work, ie, the userid text box is NOT automatically populated when the form is loaded. I am not sure if the problem is how I try to get the value, or how I tried to save it in the first place. I am at a loss as to what I am doing wrong.

Any and all help would be greatly appreciated.

Thanks in advance.
 
I'm no expert myself but i use cookies on my site and this is what it should look like i think

Dim ls_cookie
ls_cookie = Request.Cookies(&quot;username&quot;)
frmAR.textuserid.innerText = ls_cookie

if you add the <% and %> inside vbscript code area you'll get bugs. hope that helps
-Nick
 
codefinger,

the window_onload script you wrote is fine:

Sub window_onload

Dim ls_cookie

ls_cookie = &quot;<%=Request.Cookies(&quot;username&quot;)%>&quot;

frmAR.textuserid.value = ls_cookie

in your director.asp page you only need to write:
Response.Cookies(&quot;username&quot;) = Request.Form(&quot;textuserid&quot;)

instead of using 'item'

Also,

is your site running in a virtual directory in IIS?

have you set the path and expiry date for cookies?


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top