I am using Login Control available in ASP.NET 2.0 in the login page. Once the user is authenticated successfully against database, I am redirecting the user to home.aspx. Here, I want to pass on the User’s name too to the home.aspx so that the user will be greeted with his/her name in the home.aspx. Ex: Welcome Smith
I am extracting the User’s name from the users table in my database during the time I check for the login credentials.
Could someone please tell me how to do this in a secure way (may be not to secure, but a little)?
Thanks,
One good place for that kind of data would be in session. Try something like this on the first page:
and then subsequent pages in that session for that user could access
this.Session['UserName'].The best thing to do though is to create a static class to manage
Sessionfor you like so:Then your application can access session state like this:
This will give you maximum flexibility and scalability moving forward.