Here you go ,
Step1:-
In aspx add these
<tr>
<td width="12%" align="right"><input id="chkbxRempasss" type="checkbox" runat="server" name="checkbox" value="checkbox" /></td>
<td width="88%"><span class="table-col2_7">Remember my password </span></td>
</tr>
Step2:-
In Aspx.cs you can write something like this to store it in cookies
public partial class Login : System.Web.UI.Page
{
string username = string.Empty;
string pwd = string.Empty;
string encytpwd = string.Empty;
string UserID = string.Empty;
ProcessService ProcessService = new ProcessService();
protected void Page_Load(object sender, EventArgs e)
{
if (Request.Cookies["myCookie"] != null)
{
HttpCookie cookie = Request.Cookies.Get("myCookie");
txtUserName.Attributes.Add("value", cookie.Values["username"]);
txtPwd.Attributes.Add("value", cookie.Values["password"]);
Response.Cookies["myCookie"].Expires = DateTime.Now.AddDays(-1);
chkbxRempasss.Checked = true;
}
if (Page.Request.Params.Get("__EVENTTARGET") != null)
{
ChkUserLogin();
}
}
protected void ChkUserLogin()
{
try
{
HttpCookie myCookie = new HttpCookie("myCookie");
if (chkbxRempasss.Checked == true)
{
myCookie.Values.Add("username", txtUserName.Text.ToString());
myCookie.Values.Add("password", txtPwd.Text.ToString());
myCookie.Expires = DateTime.Now.AddDays(15);
Response.Cookies.Add(myCookie);
}
username = txtUserName.Text.ToString();
pwd = txtPwd.Text.ToString();
encytpwd = Encrypt(pwd, "&%#@?,:*");
string result = string.Empty;
result = ProcessService.ChkUserLogin(username, encytpwd);
if (result == "0")
{
DataSet User = ProcessService.getLoginuserdetails(username);
UserID = User.Tables[0].Rows[0][0].ToString();
Session["UserID"] = UserID.ToString();
Response.Redirect("Default.aspx");
}
else if (result == "1")
{
lblAlert.Text = "Invalid UserName.";
lblAlert.ForeColor = System.Drawing.Color.Red;
lblAlert.Visible = true;
}
else if (result == "2")
{
lblAlert.Text = "Invalid Password.";
lblAlert.ForeColor = System.Drawing.Color.Red;
lblAlert.Visible = true;
}
}
catch (Exception exn)
{
}
finally
{
}
}
All the best:) write back if you need further support!