Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

ASP.NET Forum


You are currently viewing our ASP.NET Forum as a guest. Please register to participate.
Login



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

Posts: 3
Location: Tampa
Trades: 0
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?
__________________
David A. Prichard


Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
dprichard is offline
Reply With Quote
View Public Profile Visit dprichard's homepage!
 
 
Register now for full access!
Old 08-04-2004, 02:45 PM
ACW
Average Talker

Posts: 26
Trades: 0
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 02:56 PM..
ACW is offline
Reply With Quote
View Public Profile
 
Old 08-25-2004, 05:58 PM
wfpeyton's Avatar
Average Talker

Posts: 22
Trades: 0
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

Please login or register to view this content. Registration is FREE
wfpeyton is offline
Reply With Quote
View Public Profile Visit wfpeyton's homepage!
 
Old 08-26-2004, 12:53 PM
melfan's Avatar
Skilled Talker

Posts: 90
Trades: 0
ACW is right you can only pass cookies thoughout different server pages if it is on the same server.
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE
melfan is offline
Reply With Quote
View Public Profile Visit melfan's homepage!
 
Reply     « Reply to ASP Cookie Question
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

BB 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.19214 seconds with 12 queries