|Important||This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.|
How to: Set a TextBox Web Server Control for Password Entry
A TextBox Web server control set for passwords hides a user's entry as it is being typed. Password text boxes can only be single-line text boxes.
Using a TextBox control set for passwords can help ensure that other people will not be able to determine a user's password if they observe the user entering it. However, the password text entered is not encrypted in any way, and you should protect it as you would any other confidential data. For example, for maximum security when posting a form with a password in it, you might use Secure Sockets Layer (SSL) and encryption.
To create a password text box
The Width property does not work in browsers that do not support cascading style sheet (CSS) styles.
Optionally, you can limit the number of characters the user is allowed to enter by setting the control's MaxLength property. If a user exceeds this number of characters, the control stops accepting more.
You might not want to set the MaxLength property, because it can be of use to unauthorized users who are trying to guess the password.