remember me feature in asp.net 1.1
-
if anyone knows how to implement remember me feature in asp.net 1.1 then plz provide some idea of it.
-
if anyone knows how to implement remember me feature in asp.net 1.1 then plz provide some idea of it.
Hi, this code can help. This is code for 2.0 login control u replace login1.username by ur textboxcontrol.text and by this code it will create cookie in ur local system and below code u place in ur pageload This will work fine.... CheckBox chkBox = (CheckBox)Login1.FindControl("RememberMe"); if (chkBox.Checked==true) { HttpCookie myCookie = new HttpCookie("myCookie"); //Instance the new cookie Response.Cookies.Remove("myCookie"); //Remove previous cookie Response.Cookies.Add(myCookie); //Create the new cookie myCookie.Values.Add("user", this.Login1.UserName); //Add the username field to the cookie DateTime deathDate = DateTime.Now.AddDays(1); //Days of life Response.Cookies["myCookie"].Expires = deathDate; //Assign the life period myCookie.Values.Add("pass", this.Login1.Password); } Getting after Cookie created if (Request.Cookies["myCookie"] != null) //Cookie Exists?? { HttpCookie cookie = Request.Cookies.Get("myCookie"); string user = cookie.Values["user"].ToString(); if (user != "") { Login1.UserName = user; //Write the username onto login username textbox } }
came out of hardwork
-
Hi, this code can help. This is code for 2.0 login control u replace login1.username by ur textboxcontrol.text and by this code it will create cookie in ur local system and below code u place in ur pageload This will work fine.... CheckBox chkBox = (CheckBox)Login1.FindControl("RememberMe"); if (chkBox.Checked==true) { HttpCookie myCookie = new HttpCookie("myCookie"); //Instance the new cookie Response.Cookies.Remove("myCookie"); //Remove previous cookie Response.Cookies.Add(myCookie); //Create the new cookie myCookie.Values.Add("user", this.Login1.UserName); //Add the username field to the cookie DateTime deathDate = DateTime.Now.AddDays(1); //Days of life Response.Cookies["myCookie"].Expires = deathDate; //Assign the life period myCookie.Values.Add("pass", this.Login1.Password); } Getting after Cookie created if (Request.Cookies["myCookie"] != null) //Cookie Exists?? { HttpCookie cookie = Request.Cookies.Get("myCookie"); string user = cookie.Values["user"].ToString(); if (user != "") { Login1.UserName = user; //Write the username onto login username textbox } }
came out of hardwork
thanks for the code. But i have to know how to redirect to the page which comes after login page directly. when there is cookie available at page load event then how to redirect to the next page from the login page