Question

  Asked: Feb 26 2008   9:38 AM GMT
  Asked by: Blue


how do i display session id on the web


MySQL, ASP.NET, C

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.

Subscribe to Alerts! Get questions and answers delivered to your Inbox.


E-mail me updates on this question



   SUBSCRIBE

hidden modal window

Answer Wiki (Improve, edit or add to this answer)


 RATE THIS ANSWER
0
Click to Vote:
  •   0
  •  0



Here 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.
  • AddThis Social Bookmark Button

Browse more Questions and Answers on Database and Development.

Looking for relevant Database Whitepapers? Visit the SearchOracle.com Research Library.


Discuss This Answer


You must be logged-in to discuss a question. Log-in/Register

JDantin  |   Mar 10 2008  8:08PM GMT

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