TextBox Password Mode

I have a textbox that is pulling in the password from the database

However...
When I have txtPassword.TextMode = TextBoxMode.Password
txtPassword.Text = dr("Decrypted") shows nothing

When I change the mode to remove the password mode the textbox populates.
lrbristerAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
PaulHewsConnect With a Mentor Commented:
Best practice is to not update the password unless there is text in the textbox.  Leaving it blank should leave it unchanged, and only require it when creating a new record.

Also, typically when using password mode, you would use two textboxes to verify that they match.

0
 
Om PrakashCommented:
What is the use of reading password from DB and assigning to textbox? What user will see is nothing.
0
 
xoperatorCommented:
Hey man,

Please notice that in the web world you cant assign any value to input of type password. It wont show you anything in the UI.

0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
PaulHewsCommented:
It's a security feature for the textbox.  Otherwise view code would reveal the obfuscated password.
0
 
lrbristerAuthor Commented:
om_prakash_p:
Hey man...customer wants the ability to update password with Admin access level...but with seeing the ******************** in the textbox

So..I need the ability to update the password...without anyone seeing it...in case theres someone peeking over their shoulder.
0
 
lrbristerAuthor Commented:
PaulHews:
So best practice would be to add a checkbox to "update Password" from that field?
0
 
pschramaCommented:
Shouldn't the customer just use the password textbox to enter the new password then?

Otherwise, there wouldn't be much point in having a webform with a password textbox.

If the password update originates from another source, then there's no need for the password textbox, just update it directly (from source to destination db/table).
0
 
Om PrakashCommented:
http://www.codeproject.com/KB/webforms/Set_Password_from_code.aspx
if (this.TextMode == TextBoxMode.Password)
       {
           this.Attributes.Add("value", value);
       }
0
 
lrbristerAuthor Commented:
om_prakash_p:
Sorry..I posted before you posted this
0
 
PaulHewsCommented:
>this.Attributes.Add("value", value);

This is working against the security features of the textbox, which is why I don't recommend it.
0
 
xoperatorCommented:
Please give me some points too !
0
All Courses

From novice to tech pro — start learning today.