Basically, you can achieve this functionality using cookies.
For the first time, check:
if (chkRememberPassword.Checked == true)
{
Response.Cookies["UserName"].Value = txtUserName.Text;
Response.Cookies["Password"].Value = txtPassword.Text;
Response.Cookies["UserName"].Expires = DateTime.Now.AddMonths(1);
Response.Cookies["Password"].Expires = DateTime.Now.AddMonths(1);
}
else
{
Response.Cookies["UserName"].Expires = DateTime.Now.AddMonths(-1);
Response.Cookies["Password"].Expires = DateTime.Now.AddMonths(-1);
}
And do the following in your Page_Load:
if (!IsPostBack)
{
if (Request.Cookies["UserName"] != null)
txtUserName.Text= Request.Cookies["UserName"].Value;
if (Request.Cookies["Password"] != null)
txtPassword.Text.Attributes.Add("value", Request.Cookies["Password"].Value);
if (Request.Cookies["UserName"] != null && Request.Cookies["UserName"] != null)
chkRememberPassword.Checked = true;
}
Try!