Click here to Skip to main content
15,895,557 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I want to display the username of Login Page on to the respected redirect page after successful login.For this i had taken one label on redirected page on which the username sholud be get displayed.
Posted
Comments
[no name] 18-Mar-14 1:25am    
Jas has given a solution which will help you as your requirement

You can store the UserName in Session after successful Login and use it across in all the Pages.
And on the displaying part you may use MasterPage also, which means you don't have to use Label/Literals in each Individual Pages.
 
Share this answer
 
After Validating the Username Before redirecting to another Page keep username in Context

i.e Context.Items.Add("UserName","YOur User Name");

Replace Your User Name With txtUsername.Text.

In Redirected Page

In !isPostBack

lblUserName.text=Context.Items["UserName"].toString();
 
Share this answer
 
 
Share this answer
 
v2
Use Session[^]
Try this:

In login page after validation
C#
Session["Username"]= txt_username.Text;
//redirect url


In Homepage/RedirectedPage:
C#
Label1.Text = Session["Username"].ToString();
 
Share this answer
 
v2
After successfull login u can store the user name in a session variable as below

Session["username"] = txtUser.Text;


and in the master page place a label and assign text to label as

lblUser.Text = Session["username"].ToString();
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900