By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,968 Members | 1,871 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,968 IT Pros & Developers. It's quick & easy.

PHP - ASP Session Variables

P: 8
I have a system which needs to handle both PHP and ASP.NET pages. The users login on a PHP page and there are times when I need to pass these parameters using Session Variables to ASP.

Simplified PHP Code:
[PHP]session_start();
session_register("sessFirstName");
$_SESSION['sessFirstName'] = "Fred";[/PHP]

These are the attempts I have made in ASP to retrieve the above, unfortunately they all return blank:
1. <p>first name: <%= session("sessFirstName") %></p>
2. <p>first name: <?php echo $_SESSION['sessFirstName'] ; ?></p>
3. Code Behind: lblSessNew.Text = Session("sessFirstName")
Jan 7 '08 #1
Share this Question
Share on Google+
1 Reply


eragon
100+
P: 431
I have a system which needs to handle both PHP and ASP.NET pages. The users login on a PHP page and there are times when I need to pass these parameters using Session Variables to ASP.

Simplified PHP Code:
[PHP]session_start();
session_register("sessFirstName");
$_SESSION['sessFirstName'] = "Fred";[/PHP]

These are the attempts I have made in ASP to retrieve the above, unfortunately they all return blank:
1. <p>first name: <%= session("sessFirstName") %></p>
2. <p>first name: <?php echo $_SESSION['sessFirstName'] ; ?></p>
3. Code Behind: lblSessNew.Text = Session("sessFirstName")
OK, im not quite sure why you have session_register in you code, when $sessFirstName isnt defined. That line is not needed.
$_SESSION['sessFirstName'] = "Fred";

should work and can be called by
<?=$_SESSION['sessFirstName']?>

but if that line was in an ASP page it won't do anything. Also, did you start the session in ASP too? anything past there isn't my feild. i only work in php, but i hope i helped a little
Feb 3 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.