Setting the Value of a TextBox with TextMode=Password

When the property of the TextBox ASP.NET textmode set password value set in the Text property will not display at runtime. This can be a pain, but actually by design to prevent passwords from being displayed unmasked in the HTML source of the page.

While good security reasons for not displaying the value of the masked password, leave it to unmask the source, is also necessary at times to display the masked value in the TextBox. For example, the user profile page where the user has the ability to change their passwords. It makes sense to display there. After all, the user has authenticated to get to the page (although the value is sent with the data to the browser and can easily sniff).

Side security reasons, you can work around this by adding value as a password to control attributes. Since the TextBox renders as an HTML input controls, you can set the attribute value with easy, as you would set the Text property.

PasswordText.Attributes.Add ("value", "ThePassword");

Use this to set the value, instead of setting the Text property. You can still read the value of control through the Text property.

Postingan populer dari blog ini

vb6 msflexgrid

Tutorial Visual Basic 6.0 : Listbox in VB6

Select Single Cell in MSHFlexgrid