I am working on a project which is coded in ASP.NET now I need to add some PHP pages to it. But I have to pass the email address from ASP.NET to PHP page. I know its possible by using URL transfer method but its not secured as users can modify it. I need session transfer method to pass these values. Is there any direct way to do that or indirectly is it possible by using JavaScripts or jQuery or any other method?
1 Answer
Is your information being passed over http or https? It makes a big difference. You can do something such as the following without getting too complicated:
ASP.NET > update the web.config to:
cookieRequireSSL=”true”
In your asp page:
HttpCookie cookie = new HttpCookie(‘name’);
cookie.Secure = True;
cookie.Value = ‘[email protected]’;
It's also possible to do a separate session id for http (could be md5(securesessid)) and make the association in server level; Just remember not to trust an insecure sess if going back and forth.
In your php page:
<?php
session_start();
$_COOKIE['ASP.NET_SessionId'];
$cookies = getCookies();
$sessionId = $cookies['ASP.NET_SessionId'];
?>
another way is via php/soap:
var_dump($client->_cookies);
echo "cookie is ".$client->_cookies["ASP.NET_SessionId"][0];
3 Comments
dr. null
More information can be found here: Setting Secure Cookie Flags
Karthik Malla
Good! But this is passing value from ASP.NET page but what is the syntax to receive it in PHP page?
Mad coder.
@dr.null - Can you please answer to this question stackoverflow.com/questions/8856894/…