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

cookie not working

Status
Not open for further replies.

mwa

Programmer
Jul 12, 2002
507
US
I have written two asp pages, one that writes a cookie and one that reads the cookie. I can't seem to get the cookie to show up on the second page.

page1.asp:

<%strUser = UCASE(Request.ServerVariables(&quot;LOGON_USER&quot;))
Response.Cookies(&quot;UserID&quot;)(&quot;User&quot;) = strUser
Response.Cookies(&quot;UserID&quot;).expires = date() + 1%>

page2.asp:

<%strUser = lcase(Request.Cookies(&quot;UserID&quot;)(&quot;User&quot;))
strFrom = user & &quot;@mydomain.com&quot;
Response.Write &quot;<BR>USER: &quot; & strFrom%>

page1.asp is a UI to pass some varibles into a Crystal Report. On the Crystal Report, I have a link that opens a new window with page2.asp in it. What I'm trying to do is get the user id into page2.asp without the user having to log back in. But for some reason, when the new window is opened, It will not get the cookie. Any ideas?

Thanks,
mwa
 
<%strUser = lcase(Request.Cookies(&quot;UserID&quot;)(&quot;User&quot;))
strFrom = user & &quot;@mydomain.com&quot;
Response.Write &quot;<BR>USER: &quot; & strFrom%>

Should be

<%strUser = lcase(Request.Cookies(&quot;UserID&quot;)(&quot;User&quot;))
strFrom = strUser & &quot;@mydomain.com&quot;
Response.Write &quot;<BR>USER: &quot; & strFrom%>
Adam
 
Sorry, that was just a typo in this post... I checked my code and that part is correct...

Any other ideas???

thanks,
mwa
 
OK...

I just figured it out...

I did not realize this, but in my page1.asp, part of the url was this:

/Applications/

But in my page2.asp (which was opened in a new window - &quot;_blank&quot;), the same part of the url was this:

/applications/

Apparently the cookies are case sensitive. I changed page2.asp to uppercase &quot;A&quot; and it worked...

Later,
mwa
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top