set at type password. When I try to set the value of this textbox at runtime
the text field does not get populated.
I thought I could just go
=========
txtPassword.Text = "MyPassword"
=========
If I do this, nothing appears in the textbox at all.
Any help appreciated, thanks in advance
Mark"John" <JD@.noSpam.com> wrote in message news:c5g475$s7p$1@.lust.ihug.co.nz...
> Hi all, I thought that this would be very basic. Basically, I have a
textbox
> set at type password. When I try to set the value of this textbox at
runtime
> the text field does not get populated.
> I thought I could just go
> =========
> txtPassword.Text = "MyPassword"
> =========
> If I do this, nothing appears in the textbox at all.
> Any help appreciated, thanks in advance
> Mark
This is normal behavior.
If a password would be set before the page is sent to the user,
anyone looking at the HTML source of the page would be able to
read the password.
--
Jos
Sending the password in plain text to the browser is a bad idea from a
security standpoint so the default security settings discourage it.
(Anybody can do a view source for the page
and see the password)
However there is a workaround if you're determined. You can set the
password text via client side script.
Here's the simplest example I've seen:
MyPWTextBox.Attributes.Add("value", strPassword)
This server side code outputs the needed client side code
--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
Hire top-notch developers at http://www.able-consulting.com
"John" <JD@.noSpam.com> wrote in message news:c5g475$s7p$1@.lust.ihug.co.nz...
> Hi all, I thought that this would be very basic. Basically, I have a
textbox
> set at type password. When I try to set the value of this textbox at
runtime
> the text field does not get populated.
> I thought I could just go
> =========
> txtPassword.Text = "MyPassword"
> =========
> If I do this, nothing appears in the textbox at all.
> Any help appreciated, thanks in advance
> Mark
0 comments:
Post a Comment