Standard Windows Password Character

I was writing a login form for an application I'm working on and I decided I didn't want to use the standard '*' as my password character. I wanted to use the black circle (●), the same one that windows login uses. I figured out what the Unicode value for it was (0x25CF) and then I tried to set that as the password character for my textbox through the designer but no luck it would only take standard ASCII characters. So I decided to set in my form constructor, like:

this.txtPassword.PasswordChar = '\u25CF';

Which worked so now when the user types in their password the see '●' as opposed to '*'. I just figured I would pass this along incase anyone else wants to do the same. I don't know if the same kind of thing will work in ASP.NET or not but it would be cool to find out.

UPDATE: It appears that the new textbox in .NET 2.0 contains a property UseSystemPasswordChar, that when set will make it use the system password character and literally treat it as a standard windows password textbox. Thanks to David Kean for pointint this out.

Published Saturday, September 4, 2004 3:59 PM by puzzlehacker

Comments

# re: Standard Windows Password Character

Just confirming: this kind of thing is not supported for browsers (ASP.NET). Reasons:

1) It is not part of the standard.
2) Not all Operating systems support unicode. For example, windows 98.

The latter reason will also going to limit your winforms audience... but who cares ;-)?

Saturday, September 4, 2004 4:33 PM by Justin Lovell

# re: Standard Windows Password Character

Justin,

Thanks for the information. I don't care about Win 98 but there maybe some people who do.

Saturday, September 4, 2004 8:27 PM by Wes

# re: Standard Windows Password Character

just to confirm ...

on a web app the server sends an html form that has an INPUT tag that asks for it to be a "Password" type of input.

the clients browser gets to handle that tag.

what that client app (the browser) shows the user is up to the browser and the OS.

for example what does a blind user get??
what does a text only browser get??
also if the client is some portable device it may have limited text etc...

Sunday, September 5, 2004 8:30 AM by Denny Figuerres

# re: Standard Windows Password Character

FYI: When you set the PasswordChar it also gives the ballon if CAPSLOCK is on and also gives a ballon if you try to copy the text. That is of course if you have visual styles enabled(Application.EnableVisualStyles()) at least it does for me running .NET 2.0 beta, I'm not sure about older versions of the framework.

Monday, September 6, 2004 12:25 PM by Wes

# re: Standard Windows Password Character

The above code wil not support in asp.net.i want to change asp.net textbox password.can u any one give script file to change charcter type change?

Wednesday, July 23, 2008 12:16 AM by Ramanathan

# re: Standard Windows Password Character

What about using the TextBox.UseSystemPasswordChar property?

Thursday, September 4, 2008 4:54 PM by Wil Peck

# re: Standard Windows Password Character

i wanted to use * as a password character.. wat can be done for this?

Friday, December 12, 2008 1:12 AM by Mona

# re: Standard Windows Password Character

For use in the ASP.NET, you can set the Text Mode to password which will automatically render the <input> tag's type as 'password'.

Btw, It is not possible to set the password character for text boxes on webpages. Only the default password character is allowed through the use of <input type="password" /> which ASP.NET does internally.

Saturday, July 24, 2010 11:18 AM by Amol Bhave