When your user logs in create a session variable that holds the user_id (or whatever defining information you want) like this:
Session["user_id"] = "some data";
Then you can access that at anytime during the user's session with this
String user = Session["user_id"].ToString();
hericles
Veteran Poster
1,065 posts since Nov 2007
Reputation Points: 156
Solved Threads: 228
Skill Endorsements: 9
"some data" would be whatever you wanted to store in the session variable. It could the user ID, their email, name, anything.
You place the code where ever you have your log in authentication code. If you have a log in button where you check the user name and password are correct that would be ideal. After you have verified the user you can set the session variable to indicate they have logged in successfully.
hericles
Veteran Poster
1,065 posts since Nov 2007
Reputation Points: 156
Solved Threads: 228
Skill Endorsements: 9
Yes, any variables you store in session state are available to all pages called during that session. Say you had a log in section that showed the log in boxes initially but user data if they had logged in. Each page that had that section could check the session to see what the logged in status was and dispay the appropriate stuff.
hericles
Veteran Poster
1,065 posts since Nov 2007
Reputation Points: 156
Solved Threads: 228
Skill Endorsements: 9