hi, i am using form authentication for my website which is written in ASP.Net, but i have a PHP script that i need to run. Is it possible to get the value of User.Identity.Name in PHP ?
thanks.
hi, i am using form authentication for my website which is written in ASP.Net, but i have a PHP script that i need to run. Is it possible to get the value of User.Identity.Name in PHP ?
thanks.
Yes, if you pass it on to the PHP page using POST or GET (Querystring or Form), meaning getting the value from an ASP page first and then sending it to you PHP page. You can also take a look at this question on Stack Overflow, which offers a different solution.
*Edit: Possible solutions:
The second one could work for PHP as well with a bit of creativeness.
why don't you just store the User.Identity.Name from the ASP.NET page in a session, and then when you call the PHP page you can just retrieve it from that session? As long as its the same site, it should work.
Since you mentioned loading the PHP script in an iframe, you want to do something like this:
<iframe src="myscript.php?username=<%= User.Identity.Name %>" />
This passes the Identity name along as a GET parameter, as suggested by Boekwurm.
Then, in your PHP script, grab it like so:
username = $_GET["username"];
Depending on what you're doing with it, you may need some security in place to prevent people from running the PHP script with arbitrary username parameters.