采用某种方式进行加密。
我有一个带有实体框架的MVC模式,我希望储存密码价值。 我只想写一份财产,但我发现的是,如果I dont有收益价值,那就没有储存在数据库中。 每当我访问编辑时,我就看到我的过去。 我通过在编辑观点中使用空洞通用密码输入场,能够围绕这一点开展工作。
Now, the problem I now have is if the user wants to edit their information and not change their password (by leaving it blank) it sets the password field to null even though I have not changed the value of that property.
Can anyone suggest a better method? Thanks in advance for your responses.
[DataType(DataType.Password), MaxLength(50)]
private string _Password;
public string Password
{
get
{
return _Password;
}
set
{
if(!string.IsNullOrEmpty(value))
{
_Password = FormsAuthentication.HashPasswordForStoringInConfigFile(value, "MD5");
}
}
}