Use the ASP.NET encryption password
When we build a database on the website, it is necessary to protect users' information security. Most users are not willing to let others know their own information, and the network management does not want to lose the reputation of the website because of security issues. No matter who, security issues are very important.
In order to solve this problem, I provide you with a simple and practical, but the old suit is the password encryption. Here we use ASP.NET technology to encrypt passwords. Simply put, it is to encrypt the password provided by the user, and then compare it and the data stored in the system, if the same is verified.
In ASP, the encrypted object is not provided, we can only use external objects to encrypt. Now it is good, providing encrypted solutions in ASP.NET. In the namespace system.web.security, class FormsAuthentications contains class forMsAuthentications, with a method HashPasswordforStoringInfigfile. This method can turn the characters provided by the user into garbled and then store it, and even store it in cookies.
The HashPasswordforstoringInConfigfile method is easy to use, which supports "SHA1" and "MD5" encryption algorithms.
The following code has a simple demonstration about its usage:
<% @ Page language = "c #"%>
<% @ Import namespace = "system.web.security"%>
Public void EncryptString (Object Sender, Eventargs E)
{
Sha1.text = formsauthentication.hashpasswordforstoringInconfigfile (txtpassword.text, "sha1");
Md5.text = formsauthentication.hashpasswordforStoringInConfigfile (txtpassword.text, "md5");
}
script>
hEAD>