Pregunta

I have a asp.net page and a php page for my internal use. if the asp.net application is logged in, then there will be a link to php page with which user can view the php page. if the asp.net application is logged out, then there wont be any access to the php page. In other words, one application(.net) if logged in, will give access to another application(php) So i planned to go with setting some session value and came across some forum to use cookie value (since the project is for internal use and wont be there in web)

Now using asp.net i'm able to set the cookie value (let us say the cookie name is cookie_book_id ) . Even in firefox i went to Tools >> Options >> Remove individual cookies and I was able to see the cookie set.

But when i try to access using php I was not able to access.

setcookie("Cookie_Kimz", "Cookie Value - Kimz");
echo "Cookie Values: <br>";
echo "<pre>";
print_r($_COOKIE);
echo "</pre>";

The array value I get is

Array
(
    [Cookie_Kimz] => Cookie Value - Kimz
    [PHPSESSID] => 15d088m6pu5l45bokbs27upnv1
)

I'm able to get the cookie i set using php, but i'm not able to get the cookie set using asp (i.e cookie_book_id ) Why?

FYI - Both the cookie value i.e Cookie_Kimz and cookie_book_id is there in firefox cookie (Tools >> Options >> Remove individual cookies)

Some help will be much appreciable.

Thanks, Kimz

¿Fue útil?

Solución

You can read cookies if it is set by same domain.

Cookie set by http://yourdomain.com/test.asp can be read by http://yourdomain.com/test.php

but if your domains are different then you cannot read cookies :)

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top