Click here to Skip to main content
15,896,557 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Can anyone help?

how to identify the current user and new user by using sessionID?


description:

i have sessionID in my database....by using that sessionID i'm inserting values to

the table(addcart).....right,when i first insert the one sessionID stored for one new

user....but when again i insert it should identify current user and who is new

user...............
Posted

1 solution

Here is how you set and retrieve session values:
C#
//set
Session[ "sessionID" ] = sessionID;//this is the session id from your database.

//retrieve
if( Session[ "sessionID" ] != null )
{
   String sessionID = (String)Session[ "sessionID" ];
}
else
{
   //Session value does not exist!
}


Keep in mind that sessions are unique per client-request and per browser.

Happy coding,
Morgs
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900