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.

8 Comments

  • 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 ;-)?

  • Justin,



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

  • 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...

  • 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.

  • 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?

  • What about using the TextBox.UseSystemPasswordChar property?

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

  • For use in the ASP.NET, you can set the Text Mode to password which will automatically render the 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 which ASP.NET does internally.

Comments have been disabled for this content.