Password Characters in ASP.NET

egdotnet

Regular
Joined
May 16, 2004
Messages
50
Since ASP.NET textboxes do not have a "passwordchar" property, how do you set them to display *'s rather than other text?
 
Change/Set TextMode to Password. Should be under Behavior if you are using Visual Studio. Or if you are using some other text editor, in your *.aspx file, add TextMode="Password" to your textbox.

For example, original textbox:
Code:
<asp:TextBox id="TextBox1" runat="server">

To use password characters:
Code:
<asp:TextBox id="TextBox1" runat="server" TextMode="Password">
 
Take a look at this page : http://www.codeproject.com/cs/miscctrl/passwordbox.asp
It might not be useful... but if you enter really sensitive information that is only protected by your password... this could help you.

It make sure that the textbox is actually a Password TextBox for Windows.
This has as a side effect of showing the right "dot". This also hide your password from a memory read. (At least... it's what Brian Welsh said... no ?)

If I'm wrong correct me.

Have a nice sunny day
 
Back
Top