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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

HELP!!...Can't Get Cookies to Work

Status
Not open for further replies.

TheStriker

Programmer
Aug 19, 2002
109
0
0
US
Hello,

Using ASP 3.0

I have a text box that searches for the entry the user enters and I also have a checkbox next to the textbox that says 'Remember Me' that writes a cookie. The code:

Code:
<%
If (Request.Form("RememberMe") = True) Then
Response.Cookies("SiteCode")("SiteCode") = Request.Form("SiteCode")
Response.Cookies("SiteCode").Expires = #Jan 1, 2100#
Session("MM_Username") = Request.Cookies("SiteCode")
End If
%>

and on the page that checks the cookies and redirects as necessary, the code is:

Code:
<%
Response.Buffer = True

If (Request.Cookies("SiteCode")("SiteCode") <> "") Then
Response.Redirect("../Pages/SiteInformation.asp")
End If
%>

For some reason, this code doesn't seem to work. Am I missing something? Any help is greatly appreciated.
 
First, don't write a cookie that will expire in 2100....if the user likes your site he WILL come back way before 2100...

Try amending the code of your second page to :

<%
Response.Buffer = True

If Request.Cookies("SiteCode")("SiteCode") <> "" Then
Response.Redirect("../Pages/SiteInformation.asp")
End If
%>
 
Thanks Eek,

This is an intranet site so the long expiration date will be required. After countless hours trying new things, I finally got it to work properly. But your response pointed me in the right direction. Thanks again

Striker
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top