简体   繁体   中英

How to remember login details by browser once user is logged in

am working on one customer's website that is developed in Asp.Net MVC. There is one requirement from the customer to remember the login details or info once user is logged into the website. So the next time user doesn't need to enter the details again. This functionality works fine in Google Chrome but doesn't work in IE for it. I checked the settings in IE by enabling to remember login details but no luck so far. Even i checked many other sites whose login details are saved in IE.

Can you please suggest me some solution if you have come across such problem? Is there any browser compatibilty issue? Looking forward for your reply!!!

localStorage can do that.

https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage

Example:

var loginInfo = {a:"a", b:"b"};

localStorage.setItem('loginInfo', loginInfo);

var getInfo = localStorage.getItem('loginInfo');

console.log(getInfo);

I'm used to save data that way for convenience, but for security, I do not recommend this way.


You can also use document.cookie to achieve that:

document.cookie = "username=John Doe;somthing=Other";

For server side, the most use way is save in the session.

By session, servers can remember who the user is easily and securely.


There're many kinds of remembering user details, so it depends on what you would like to use.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM