I am new to C# Programming.
I had drag a login control into my website. But the “Remember me” seem not to be working if i didn’t add any codes in.
Anyone can teach me how to implement the “remember me” in c#?
I want it to be when the user revisit the website, he/she type onto the username textbox, the password will be retrieved from the database and display on the password textbox and at the same time the rememberme checked box will be check.
I had been researching this for the code for was for days, but was not fruitful.
Anyone can give me a tutorial on this?
Desperately wanting to know how it works.
Hope to get reply soon.
Thank.
From MSDN:
If you want the control to display a “Remember me next time” check box, set the
DisplayRememberMeproperty totrue. If a user selects the “Remember me next time check box” when he or she logs in, the authentication token will be stored in a persistent cookie in the browser.If you want the “Remember me next time” check box to be selected by default, set the
RememberMeSetproperty totrue.If you want the authentication token to be stored in a persistent cookie without giving the user the option to clear the “Remember me next time” check box, set the
RememberMeSetproperty totrueand set theDisplayRememberMeproperty tofalse. This is not recommended for sites that can be accessed from public computers that serve multiple users, as a user’s persistent authentication token could be used by an unwanted user.That’s not how the “Remember Me” checkbox works. All the checkbox does is store an authentication ticket in a cookie in the browser. When the user revisits the site, there is no prompt for login as the authentication ticket already exists, so the user is automatically logged in.
It’s conceivable that you could modify the login ASCX with some JavaScript to do exactly what you want, but in good conscience I cannot recommend you do that as it would render your site incredibly insecure.