Reputation: 10913
I'm not sure how to obfuscate input on a form when accepting password entry using vb.net. Rather than echoing the password, I just want to echo asterisks, like this:
Actual password input:
swordfish
What the user sees:
*********
How do I accomplish this?
Upvotes: 3
Views: 13111
Reputation: 34592
The problem with typpo and jon's answer is the textbox input based on PasswordChar
property is that it is insecure! Select the text masked by asterisks, copy it to the clipboard and paste it into say, notepad for an example, the password is revealed!
See here for an article explaining how to protect it, and also here,
The first link is written in VC, ok, it is not in the language of your choice, but it will highlight how to get around password revealers that can unmask the password input. The second link is in C# which shows how to ensure a user has selected/entered a password based on the strength of the input.
Those two links should help you in the direction in
Using both can help you in ensuring your password input is secure enough and to keep the end-user and management alike, feeling confident that the set up is indeed secure in relation to password inputs.
Upvotes: 6
Reputation: 50728
In a VB form? I think you set the PasswordChar property to a character, it will show password chars.
If in a webform, set textbox.textmode to password.
Upvotes: 0
Reputation: 11132
Set the PasswordChar
property of a textbox to the character *, eg.
textBox.PasswordChar = "*"c
Upvotes: 9