开发者

Security cookies ASP.NET

开发者 https://www.devze.com 2023-01-10 22:02 出处:网络
I\'ve a code to persist inf开发者_JS百科ormation in cookies about users like UserName and password.

I've a code to persist inf开发者_JS百科ormation in cookies about users like UserName and password.

Question is:

Its not secure to store information like that plain text in cookies.My DB store hashed passwords,so i could save those hashs in cookies and retrieve them later,but if i do that i wouldnt be able to fill password's textbox cause the hash string would be too long for it.

Is there any solutions?


You never should store Passwords in plain text, and even a hashed password can be vulnerable to reverse-lookup unless it is salted correctly. ASP.NET Forms Authentication already lets you create a Persistent authentication cookie that will allow the user to stay logged in, so you should use that instead. See the Timeout, expires, and IsPersistant properties when Creating the Forms Authentication Cookies.

Alternatively you could setup a token based authentication system, by which users get a security token after they enter their login information and this token is valid for a specified amount of time. This is how Live ID and Google Accounts work, and they usually store the tolken in a cookie that is valid for weeks at a time.

0

精彩评论

暂无评论...
验证码 换一张
取 消