CS文件密码加密类
private string _PasswordFormat;
public Security(string PasswordFormat)
{
//
// TODO: 在此处添加构造函数逻辑
//PasswordFormat
this._PasswordFormat = PasswordFormat;
}
public string EncryptPassword(string PasswordString)
{
if (_PasswordFormat == "SHA1")
{
return System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(PasswordString, "SHA1");
}
else
{
if (_PasswordFormat == "MD5")
{
return System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(PasswordString, "MD5");
}
else
{
throw new Exception("Error Password Fromat define.");
}
}
}