0

hi there,
I have to display some user specific info;so i need to save my login page credentials to show only that user's info.So plz help me as how to store login page info in session variable and how to access that info in some other page in ASP.NET.
thnx

2
Contributors
1
Reply
2
Views
7 Years
Discussion Span
Last Post by love_dude1984
0

you can make use of session variables. If the login is successful, then on the put this code

Session["id"]=[I]Id of the user[/I]
Session["pwd"]=[I]password of the user[/I]

& then redirect to the next page. on that page, on page load event, retrieve the session values as follows,

string var1=Session["id"].ToString();
string var2=Session["pwd"].ToString();

now, var1 & var2 have your login credentials, fire a query to the database to retrieve the corresponding values of that credentials.

you can make use of as many as session variables. & at the time of logout, clear the session with

Session.Abandon()

.

For more info. on session Click Here

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.