I have entered my user name and password and checked remember me ==true, So I created cookies to save username and password. saved but not remembered password when i enter user name and I used...
My Code in Project
protected void LoginButton_Click(object sender, EventArgs e)
{
CheckBox RememberPassword = (CheckBox)Login1.FindControl("RememberMe");
FormsAuthentication.SetAuthCookie(Login1.UserName, RememberPassword.Checked);
if (RememberPassword.Checked)
{
HttpCookie cookie1 = new HttpCookie("MyCookie");
cookie1.Values.Add("username", Login1.UserName);
cookie1.Values.Add("password", Login1.Password);
cookie1.Expires = DateTime.Now.AddDays(2);
Response.AppendCookie(cookie1);
Response.Cookies.Add(new HttpCookie(FormsAuthentication.FormsCookieName, "MyCookie"));
}
}
In Page Load
if (HttpContext.Current.Request.Cookies["MyCookie"] != null)
{
if (Request.Cookies["MyCookie"].HasKeys)
{
HttpCookie cookie = Request.Cookies.Get("MyCookie");
TextBox pass = (TextBox)Login1.FindControl("Password");
pass.Attributes.Add("value", Request.Cookies["MyCookie"]["password"]);
Login1.UserName = Request.Cookies["MyCookie"]["username"];
}
}
I have entered my user name and password and checked remember me ==true, So I created cookies to save username and password. saved but not remembered password when i enter user name and I used login controls to create username and password
//Required
I need to display password automatically in password textbox if username entered..........
Please It's very Important to me reply me soon