Hi there..I am having some trouble implementing the "Remember Me" check box on my asp:login control.
I am able to set the cookie when the user checks the box, and I can read the cookie and pre-populate the userid field, but I can't automatically check the checkbox...
Can someone tell me what I am doing wrong?
TextBox txtUser = ctlLogin.FindControl("UserName") as TextBox;
if (!IsPostBack)
{
if (Request.Cookies["myCookie"] != null)
{
HttpCookie cookie = Request.Cookies.Get("myCookie");
ctlLogin.UserName = cookie.Values["username"].ToString();
CheckBox rm = (CheckBox)ctlLogin.FindControl("RememberMe");
rm.Checked=true;
}
this.SetFocus(txtUser);
}
smithygreg
Member
2 Points
10 Posts
ASP:Login Remember Me functionality
Mar 15, 2007 03:25 PM|LINK
Hi there..I am having some trouble implementing the "Remember Me" check box on my asp:login control.
I am able to set the cookie when the user checks the box, and I can read the cookie and pre-populate the userid field, but I can't automatically check the checkbox...
Can someone tell me what I am doing wrong?
TextBox txtUser = ctlLogin.FindControl("UserName") as TextBox; if (!IsPostBack) { if (Request.Cookies["myCookie"] != null) { HttpCookie cookie = Request.Cookies.Get("myCookie"); ctlLogin.UserName = cookie.Values["username"].ToString(); CheckBox rm = (CheckBox)ctlLogin.FindControl("RememberMe"); rm.Checked=true; } this.SetFocus(txtUser); }Thanks
Greg
ASP.Net Login