Click here to Skip to main content
15,913,487 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am developing web application. i want to add a functionality which remember password if check box is checked...............

plese help me...........................
Posted

Thank you for your question. You can follow the bellow code.

C#
private void CustomizeLoginControl()
        {
            
            if (Request.Cookies["MyCookie"] != null)
            {
                TextBox userName = (TextBox)Login1.FindControl("UserName");
                userName.Attributes.Add("value", Request.Cookies["MyCookie"]["username"]);
                TextBox pass = (TextBox)Login1.FindControl("Password");
                pass.Attributes.Add("value", Request.Cookies["MyCookie"]["password"]);

            }

        }
        private void setRememberMe()
        {
            HttpCookie cookie1 = new HttpCookie("MyCookie");

            cookie1.Values.Add("username", Login1.UserName);
            cookie1.Values.Add("password", Login1.Password);

            cookie1.Expires = DateTime.Now.AddDays(1);//cookie Expires 
            HttpContext.Current.Response.AppendCookie(cookie1);
        }


Thanks,
Mamun
 
Share this answer
 
What about coming here with your code snippet?

Use Cookies.

Remember username and password in ASP.NET
[^]
Also try
Login Control in ASP.NET[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900