Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/262.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 在MVC4中使用HTML.EditorForPassword()_C#_Html_Asp.net_Asp.net Mvc 4_Login - Fatal编程技术网

C# 在MVC4中使用HTML.EditorForPassword()

C# 在MVC4中使用HTML.EditorForPassword(),c#,html,asp.net,asp.net-mvc-4,login,C#,Html,Asp.net,Asp.net Mvc 4,Login,我创建了一个Editlogin.cshtml页面,可以在其中编辑用户的所有属性。我的用户有密码,所以当我更改他的密码时,它可以正常工作。但是,当我不写任何密码时,我的页面必须给我写一个密码,但有时我确实想保留以前的密码。我使用实体框架,并在模型类中使用密码属性的属性: [Required(ErrorMessage = "Please type Password", AllowEmptyStrings = false)] public global::System.String P

我创建了一个Editlogin.cshtml页面,可以在其中编辑用户的所有属性。我的用户有密码,所以当我更改他的密码时,它可以正常工作。但是,当我不写任何密码时,我的页面必须给我写一个密码,但有时我确实想保留以前的密码。我使用实体框架,并在模型类中使用密码属性的属性:

    [Required(ErrorMessage = "Please type Password", AllowEmptyStrings = false)]
    public global::System.String Password
    {
        get { //omitted}
        set { //omitted}
    }
这是一把双刃剑。当我创建新用户时,我必须写入新密码。但是,如果我编辑一个用户,我有时会想保留以前的密码。
如何解决此问题?

为什么不在单独的功能中选择退出表单编辑中的密码更改更改更改密码,密码字段重置对于安全目的很好。

这是不可能的。我想这样做。