Posted by Sébastien Lachance with Comments (0)
I have a basic scenario which i'm required to display a page where an user can change his user information, including his password. I decided to use an ASP.NET Textbox control which have a TextMode of password. But, when I put the password in the Text property, nothing will be displayed. The value will also be cleared after a postback event.
There is an easy workaround, you can add the "value" attribute with the password as your value.
txtPassword.Attributes.Add("value", "strongPassword");
But why can't we just set the value the normal way? Basically, it's for security reasons. The password will be set as clear text in the HTML and malicious user could have access to it. This is why you need to stay away from this method if you store sensitive information.
Related posts