Reply
ASP Cookie Question
Old 07-22-2004, 01:28 PM ASP Cookie Question
dprichard's Avatar
Junior Talker

Posts: 3
Location: Tampa
I built two pages. One is on an ASP machine and the other one is on a PHP server. The first page has the following code:

Code:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<%
Response.Cookies("testcookie")="testcookievalue"
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
</head>
<body><meta http-equiv="refresh" content="1;URL=http://www.leadershippinellas.com/test.php">
</body>
</html>
I am trying to pass this cookie from an ASP page to a PHP page. Here is the code I am using on the PHP page:

Code:
<html>
<body><?php
if (isset($_COOKIE["testcookie"]))
echo "Welcome " . $_COOKIE["testcookie"] . "!<br />";
else
echo "You are not logged in!<br />";
?></body>
</html>
I can't get it to see the cookie? Is this even possible?
dprichard is offline
Reply With Quote
View Public Profile Visit dprichard's homepage!
 
When You Register, These Ads Go Away!
     
Old 08-04-2004, 01:45 PM
ACW
Average Talker

Posts: 26
Cookies are domain specific and if I understand you correctly you have 2 different machines with 2 different URLs.

You should be able to set a cookie in an ASP page and retrieve it in a PHP page in the same domain. But you can't do it across domains - it is a security feature.

Last edited by ACW : 08-04-2004 at 01:56 PM.
ACW is offline
Reply With Quote
View Public Profile
 
Old 08-25-2004, 04:58 PM
wfpeyton's Avatar
Average Talker

Posts: 22
From your code it would appear the you have not set a timeout for the cookie. This means that it will disappear instantly when you leave the page.

To expire a cookie one year from a specific date (DT), you should use a line like:

Response.Cookies("CookieName").Expires=dateAdd("yy yy", 1, DT)

Regards,
__________________
W F Peyton
Web Site Analytics for Serious e-Commerce Sites from Web Stats Gold
www.webstatsgold.com
wfpeyton is offline
Reply With Quote
View Public Profile Visit wfpeyton's homepage!
 
Old 08-26-2004, 11:53 AM
melfan's Avatar
Skilled Talker

Posts: 90
ACW is right you can only pass cookies thoughout different server pages if it is on the same server.
melfan is offline
Reply With Quote
View Public Profile Visit melfan's homepage!
 
Reply     « Reply to ASP Cookie Question
 

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.13824 seconds with 13 queries