How to show username and password in one label control after redirecting from one page to another
hi all,I have a small application in that login form with user id and password is there so after entering userid and password and click on a button it has to redirect to next page so in next page one button and label control is there so when u click on button the username and password what we have entered in first page should show in second page in label control below is my code where i am wrong help me
webform1.aspx
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace WebApplication4
{
public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
Session["uname"] = TextBox1.Text;
Session["password"] = TextBox2.Text;
if (TextBox1.Text == "ravi" && TextBox2.Text == "123456")
{
Response.Redirect("~/WebForm2.aspx");
}
}
}
}
webform2.aspx
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace WebApplication4
{
public partial class WebForm2 : System.Web.UI.Page
{
int i=1;
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
Label1.Text = Session["uname"].ToString();
Label1.Text = Session["password"].ToString();
//Label1.Text = Request.QueryString["[0][1]"].ToString();
////Label1.Text = Request.QueryString["password"].ToString();
}
}
}