ASP.Net MVC3 Html.PasswordFor不填充 [英] ASP.Net MVC3 Html.PasswordFor does not populate
问题描述
在我看来,我有以下元素
In my view I have the following element
@Html.PasswordFor(model => model.Password)
这是创建/更新用户的详细信息在屏幕上。当我试图更新用户这一领域保持空白。当我改变这个元素为TextBoxFor它得到的数据。我如何去填充密码字段。
This is on a screen that creates/updates user details. When I am trying to update the user this field remains blank. When I change this element to a TextBoxFor it gets the data. How do I get to populate the Password field.
推荐答案
这是有意设计的。密码不含有未加密的密码填充prevent意外重新提交,并prevent的页面。显然,密码是错误的开始,如果你回发的凭据。
This is as designed. Passwords are not filled to prevent accidental resubmits, and to prevent the page from containing unencrypted passwords. Obviously the password was wrong to begin with if you're posting back the credentials.
在你的情况,你可以创建一个具有输入数据的延伸,或者只是使用类型密码的HTML输入。
In your case, you could create an extension that does input the data, or just use an HTML input of type password.
这篇关于ASP.Net MVC3 Html.PasswordFor不填充的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!