This article to learn how to use cookies in the ASP.net to save the user's account password to achieve the function of automatic login, to emphasize that cookies are stored on the client, is not safe, the recommended use of MD5 encryption to save.
asp.net, use cookies to save account password, login automatically ...
Creating cookies
Writing cookies to the client
HttpCookie hcUserName1 = new HttpCookie ("uname"); Create a cookie named uname
Hcusername1.expires = DateTime.Now.AddDays (7); Set the valid time for this cookie
Hcusername1.value = uname; Assign a value to a cookie (that is, the account you want to save, or the password)
HTTPCONTEXT.CURRENT.RESPONSE.COOKIES.ADD (HCUSERNAME1); Submitting cookies
Extract Cookies
if (httpcontext.current.request.cookies["uname"]!= null)//If this uname cookie is not empty
String uname = httpcontext.current.request.cookies["uname"]. Value.tostring (); Extract Cookies
Destroying cookies
Set the cookie time to-1, that is, the cookie expires, destroys
httpcontext.current.response.cookies["Uname"]. Expires = DateTime.Now.AddSeconds (-1);