I have a typical sign-up form with two password fields.
<form>
<%= Html.TextBox("Email", null) %>
<%= Html.Password("password", null) %>
<%= Html.Password("confirmPassword", null) %>
<input type='submit' />
</form>
If the form fails validation and is redisplayed, the text field retains its value but the password fields are always blank.
Why shouldn't the password fields retain their values? And more importantly, is there any reason I shouldn't override this behavior?
I feel like this behavior decreases usability, and would prefer password fields to behave the same way as textbox fields -- keeping the entered value when validation errors exist.
I'm using ASP.NET MVC, but this question pertains more to usability and security. I understand that what I'm seeing is expected behavior, and taking a look at the Password(...) method shows me that it explicitly ignores the value in ModelState.