The TextBox with TextMode = "Password" will be empty after assign a value using txtPassword.Text = Password
In Order to make it work and display ***** in the TextBox, replace
txtPassword.Text = Password;
with below method. This will work
txtPassword.Attributes.Add("value", Password);
4 comments:
If you do this your passwords will be exposed when someone views source.
Thanks for comment.I think it's depend on how we want to use it.
Yes the password would be exposed when someone views the source or uses a packet snooper. To prevent that, you could use SSL to access the page.
Myself, I have been looking this solution for awhile.
Hello, regarding asp.net textbox using textmode=password. I need the textbox to display "****" - asteriks but it is displaying "....." - dots. I found out that windows forms textbox class has a property called PasswordChar but textbox WEB control does not have that property. How can I set that as asteriks??
Post a Comment