Username log in program in c#?
i want code to log in username code when the username write his name and press submit there will be text block that change to welcome" the user name "
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Sanjeeb LenkaRank #301 · 8.3K reputationPosted Jun 18, 2013, 6:37 AM EDT
http://dotnetdots.wordpress.com/2013/04/24/simple-login-application-in-windows-c/
Any problem rply
Pankaj PandeyRank #642 · 3.7K reputationPosted Jun 18, 2013, 8:51 PM EDT
take a label and write the code..
Label1.Text="welcome "+TextBox1.Text;
Iftikar HussainRank #423 · 5.9K reputationPosted Jun 18, 2013, 9:02 PM EDT
Are you doing this in WebApplication? If yes, then after submitting the User Name you can store in Application variable. Then in your page just read the value from the Application variable and display it. Like below
In Login.aspx, after click on Submit button
protected void BtnSubmit_Click(object sender, EventArgs e)
{
Application["UserName"]=TxtBox1.Text;
}
In your main page like Home.aspx
protected void Page_Load(object sender, EventArgs e)
Please let me know if you need more information
Regards,
Iftikar
Remember to click "Mark as Answer" on the post, if it helps you.
amr kamal35 reputationPosted Jun 20, 2013, 4:11 PM EDT
Iftikar HussainRank #423 · 5.9K reputationPosted Jun 20, 2013, 8:11 PM EDT
You can use the above solution for the same. Lets say in WebForm1.aspx you have text box named TxtBxUserAddress.Text. Then in that page you have Save or Any button by which you will read the textbox value in code behind and store it in Application variable. Like
BtnSave_Click(object obj,EventArgs e)
{
Application["UserAddress"]=TxtBxUserAddress.Text;
}
Now you redirect to another page say WebForm2.aspx, in that inside Page_Load event you can read the value from Application and display to the Label
in WebForm2.aspx
Page_Load(object obj, EventArgs e)
{
LblUserAddress.Text=Convert.ToString(Application["UserAddress"]);
}
Let me know if you need still more information.
Regards,
Iftikar
Remember to click "Mark as Answer" on the post, if it helps you.