简体   繁体   中英

ASP.NET Password textbox, has text as characters entered

When I look at gmail on my mobile web browser the password textbox hashes the characters as I type so I can see the actual input as I type before is hashed with an asterisk.

So as I enter it becomes, P --> *a --> **s etc..

How is this done? I presume its javascript? If somone can point me in the right direction that would be great.

This is not asp.net nor a function of gmail.

this is a behavior enabled by your phone's OS.

Rather than use an asp.net control, you can do something like this (DISCLAIMER: I don't know how secure this is--I have doubts about handling passwords in unprotected strings; see below...):

Include this markup in the html section:

<input type="password" id="myPass" name="myPass"/>

And do this in the code behind:

string password = Request.Form["myPass"];  // now an insecure password string.

However, you might want to use a safer string class (eg SecureString) to handle passwords--though I am not sure how useful that would be once it's already been stored in the clear in the Request.Form object.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM