50 pts.
 how do i display session id on the web
hi, I am doing a login page with mysql and asp.net/c#. I would like the program to run in the following sequence. 1. the user login 2. the login page will search through mysql database, 3. when it is Authenticate, it will allow the user to access. my concern now is how to you use the session id to display the username when it is login.

Software/Hardware used:
ASKED: February 26, 2008  9:38 AM
UPDATED: March 10, 2008  8:08 PM

Answer Wiki:
<a href="http://www.csharphelp.com/archives/archive185.html">Here</a> is a good article on the sesion object. This is likely the object you are going to want to call from within your code to display the session ID. You likely will need to wrap some code (and possibly database tables or rows) around linking the session ID's to the login and authentication you put in place for your site.
Last Wiki Answer Submitted:  February 26, 2008  3:45 pm  by  Jerry Lees   5,320 pts.
All Answer Wiki Contributors:  Jerry Lees   5,320 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

A little bit more details to follow the previous answer…

After authenticating your user, set up his user name in Session:
Session[“UserName”> = myUserName;
where myUserName is the value you got for your user name from your authentication process / DB.

To display it in other pages, just pull your UserName variable from the Session:
String myUserName = (String) Session[“UserName”>;

You need to put this in a try / catch block too. If your session times out, you won’t be able to pull this value and need to take care of the exception.

Hope this helps!

Joelle

 335 pts.