1. Open Visual Studio
2. Create a New Website
3. Create 2 Web Pages as below
2. Create a New Website
3. Create 2 Web Pages as below
4. Write the code on Button_Click event
protected void Button1_Click(object sender, EventArgs e)
{
Session["username"] = txtusername.Text;
Response.Redirect("SessionDisplay.aspx");
}
5. Add Web Page SessionDisplay.aspx and placeLabel on it.
6. Write code on Page_Load event of SessionDispaly.aspx. you will see result as below image
if (Session["username"] != null)
{
Label1.Text = Session["username"].ToString();
}
No comments:
Post a Comment
Thanks