Setting the value of Password field in Asp.net


When the TextMode property of an ASP.NET TextBox is set to the value set in the Text property password is not displayed at runtime. This may be a pain, but it is actually the design of the exposed password avoid that is displayed in the HTML page source.

As the safety is good not appear masked password value, the unmasked in the source, must also turn on the masked value in the textbox. For instance, a user profile page where the user has the option to change their password. It is appropriate to display there. Indeed, the user has already authenticated to the page (although its value sent with the data that the browser and can easily be sniffed).

Safety side, you can work around this by adding the password value to the control as an attribute. Since the TextBox create an HTML input control, you can easily attribute value, just as you would the Text property to set.

txtPassword.Attributes.Add("value", "Password_Value");

Tags: ,

Comments & Responses

Leave a Reply

Your email address will not be published. Required fields are marked *

*


4 + = 8

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>