As per your requirement the following code will help you for sure.
1st of all Write the following Code inside the Login Button after your validation code:
protected void Button1_Click(object sender, EventArgs e)
{
HttpCookie obj=new HttpCookie("Identity");
obj.Values["UName"]=tbUser.Text;
obj.Values["Pwd"]=tbPwd.Text;
Response.Cookies.Add(obj);
if (cbRemember.Checked)
obj.Expires = DateTime.Now.AddMonths(3);
else
obj.Expires = DateTime.Now.AddMonths(-1);
}
Now write the following code inside Page_Load event:
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
if (Request.Cookies["Identity"] != null)
{
tbUser.Text = Request.Cookies["Identity"]["UName"].ToString();
tbPwd.Attributes.Add("value", Request.Cookies["Identity"]["Pwd"].ToString());
cbRemember.Checked = true;
}
}
}
I've tested this code in my System & It's working fine.
Use it & Accept as Solution if get your Result.