Showing posts with label fields. Show all posts
Showing posts with label fields. Show all posts

Saturday, March 24, 2012

Passing Variables

I have a asp page named welcome.asp where I have three input text
fields and a button named submit.
When I fill text in these text fields and click on button it passes
all those information to another aspx page.
the difference is my source page is written in classic asp and my
destination page is aspx.
Is this possible to pass values from asp page to aspx page. If so,
could you please send me xsom code.

Thanks,On Jun 11, 11:41 pm, bba...@.yahoo.com wrote:

Quote:

Originally Posted by

I have a asp page named welcome.asp where I have three input text
fields and a button named submit.
When I fill text in these text fields and click on button it passes
all those information to another aspx page.
the difference is my source page is written in classic asp and my
destination page is aspx.
Is this possible to pass values from asp page to aspx page. If so,
could you please send me xsom code.
>
Thanks,


Request.Form["text_field_from_asp"] ?
On Jun 11, 2:45 pm, Alexey Smirnov <alexey.smir...@.gmail.comwrote:

Quote:

Originally Posted by

On Jun 11, 11:41 pm, bba...@.yahoo.com wrote:
>

Quote:

Originally Posted by

I have a asp page named welcome.asp where I have three input text
fields and a button named submit.
When I fill text in these text fields and click on button it passes
all those information to another aspx page.
the difference is my source page is written in classic asp and my
destination page is aspx.
Is this possible to pass values from asp page to aspx page. If so,
could you please send me xsom code.


>

Quote:

Originally Posted by

Thanks,


>
Request.Form["text_field_from_asp"] ?


Is Request.form should be in destination web form or source webform.
<bbawa1@.yahoo.comwrote in message
news:1181603240.417819.11150@.a26g2000pre.googlegro ups.com...

Quote:

Originally Posted by

On Jun 11, 2:45 pm, Alexey Smirnov <alexey.smir...@.gmail.comwrote:

Quote:

Originally Posted by

>On Jun 11, 11:41 pm, bba...@.yahoo.com wrote:
>>

Quote:

Originally Posted by

I have a asp page named welcome.asp where I have three input text
fields and a button named submit.
When I fill text in these text fields and click on button it passes
all those information to another aspx page.
the difference is my source page is written in classic asp and my
destination page is aspx.
Is this possible to pass values from asp page to aspx page. If so,
could you please send me xsom code.


>>

Quote:

Originally Posted by

Thanks,


>>
>Request.Form["text_field_from_asp"] ?


>
Is Request.form should be in destination web form or source webform.
>


http://groups.google.com/group/micr...5addf17bc2a9da2

Passing Variables

I have a asp page named welcome.asp where I have three input text
fields and a button named submit.
When I fill text in these text fields and click on button it passes
all those information to another aspx page.
the difference is my source page is written in classic asp and my
destination page is aspx.
Is this possible to pass values from asp page to aspx page. If so,
could you please send me xsom code.
Thanks,On Jun 11, 11:41 pm, bba...@.yahoo.com wrote:
> I have a asp page named welcome.asp where I have three input text
> fields and a button named submit.
> When I fill text in these text fields and click on button it passes
> all those information to another aspx page.
> the difference is my source page is written in classic asp and my
> destination page is aspx.
> Is this possible to pass values from asp page to aspx page. If so,
> could you please send me xsom code.
> Thanks,
Request.Form["text_field_from_asp"] ?
On Jun 11, 2:45 pm, Alexey Smirnov <alexey.smir...@.gmail.com> wrote:
> On Jun 11, 11:41 pm, bba...@.yahoo.com wrote:
>
>
> Request.Form["text_field_from_asp"] ?
Is Request.form should be in destination web form or source webform.
<bbawa1@.yahoo.com> wrote in message
news:1181603240.417819.11150@.a26g2000pre.googlegroups.com...
> On Jun 11, 2:45 pm, Alexey Smirnov <alexey.smir...@.gmail.com> wrote:
> Is Request.form should be in destination web form or source webform.
>
http://groups.google.com/group/micr...5addf17bc2a9da2

Friday, March 16, 2012

Password and confirm password fields

Hi all.
I need to develop simple web page with username and password definition. When page is reloaded while onserwer integrity check, password and confirm password fields are erased. How can I prevent it?that is what normally happens, its a security issue, that the password field is to be emptied when page is reloaded.

regards.
But how can I over fit it? I saw pages when you chose region, for example, and turn to data base to get cities (reloading) but password field stay the same it was before.
Hello, try to enable ViewState for the current server control.

regards.
Opps posted wrong code sorry!!

Password Fields and Postbacks

All,

We're trying to determine how to deal with password fields losing their
state on a post back.

We've got a form that implements post backs to carry out server side
processing. As a result of the post back, passwords entered by the user
lose their values and the user gets an error message upon final validation
when they submit. Here's an illustration:

1. Password : [ ]

2. Confirm: [ ]

3. Select something from a list: [ ]
// this could cause a post-back, which wipes out the passwords

4. Some other field: [ ]

5. Hit submit key

After hitting the submit key (5), the user gets an error message, because
the passwords are now blank as a result of the post back in step #3. What
techniques should be used to get around this? We've tried fiddling with
the VIEWSTATE, to remember values, but it seems like their should be better
way... (?)

-- dwaThere is a reason why passwords don't survive postbacks, and it's built into
the browser. In fact, if you enter a password into a password field in any
HTML form, navigate away from it, and return to the page using the Back
button, the form fields will all have their values, EXCEPT for the password
fields. Why? To prevent anyone from stealing another person's password by
doing so. Even if you manage to circumvent this, and I can think of one or
two ways you might, are you sure you want to abandon the security that this
affords, which all browser manufacturers seem to think is extremely
important?

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"dwa" <da@.hotmail.com> wrote in message
news:eaI0#Hy#DHA.2520@.TK2MSFTNGP11.phx.gbl...
> All,
> We're trying to determine how to deal with password fields losing their
> state on a post back.
> We've got a form that implements post backs to carry out server side
> processing. As a result of the post back, passwords entered by the user
> lose their values and the user gets an error message upon final validation
> when they submit. Here's an illustration:
> 1. Password : [ ]
> 2. Confirm: [ ]
> 3. Select something from a list: [ ]
> // this could cause a post-back, which wipes out the passwords
> 4. Some other field: [ ]
> 5. Hit submit key
> After hitting the submit key (5), the user gets an error message, because
> the passwords are now blank as a result of the post back in step #3. What
> techniques should be used to get around this? We've tried fiddling with
> the VIEWSTATE, to remember values, but it seems like their should be
better
> way... (?)
> -- dwa

Password Fields

Does any one know how to put text into a password field.> Does any one know how to put text into a password field.
Same as any other text field... < ... value="hello world" ... >
> Same as any other text field... < ... value="hello world" ... >
I've got it sussed now, thanks.
You idea did not work, although the text property is set, it does not
display it. Its neccessary to set the text property, and use
txtBox.Attributes.Add("Value",someString)
With both set it displays the asterisks and stores the Text value.
Setting the Text property of the password-mode text box may not work. You
have to use the Attributes collection of the textbox.
txtPwd.Text = "mypwd"; // This will not pre-populate the password field
txtPwd.Attributes.Add ("VALUE", "mypwd"); // but this will...
However, sending a default password is not recommended.
HTH
"Josh" <someone@.microsoft.com> wrote in message
news:OVD$hDtpEHA.1160@.tk2msftngp13.phx.gbl...
Does any one know how to put text into a password field.

password fields

why is it that password fields:

<asp:TextBox Id="txtuserpassword1" TextMode="password" class="textbox" maxlength="20" Columns="15" Runat="Server" /><br
clear everytime validation kicks in or on page refreshes? Can this be stopped? Help!
Also, I can't auto-populate the password field uising a database value.

Help. Thanx.This is the default behavior. If password fields were to refresh, they would have to be stored in ViewState. Since ViewState is stored on the HTML rendered to the browser, the user can easily do a view source and have access to the password. This defeats the purpose of having the password masked.

There is no way to override this, unless you make a custom control, or some other work around.

hope this helps,
John

"Chris" wrote:

> why is it that password fields:
> <asp:TextBox Id="txtuserpassword1" TextMode="password" class="textbox" maxlength="20" Columns="15" Runat="Server" /><br>
> clear everytime validation kicks in or on page refreshes? Can this be stopped? Help!
> Also, I can't auto-populate the password field uising a database value.
> Help. Thanx.
ok, I can buy the "refresh" reason but what about setting to a value via a database call:

txtuserpassword1.Text = "" & memberdata("USER_PASSWORD")
txtuserpassword2.Text = "" & memberdata("USER_PASSWORD")

they won't populate, why?
thanx.

"John Sivilla" wrote:

> This is the default behavior. If password fields were to refresh, they would have to be stored in ViewState. Since ViewState is stored on the HTML rendered to the browser, the user can easily do a view source and have access to the password. This defeats the purpose of having the password masked.
> There is no way to override this, unless you make a custom control, or some other work around.
> hope this helps,
> John
> "Chris" wrote:
> > why is it that password fields:
> > <asp:TextBox Id="txtuserpassword1" TextMode="password" class="textbox" maxlength="20" Columns="15" Runat="Server" /><br>
> > clear everytime validation kicks in or on page refreshes? Can this be stopped? Help!
> > Also, I can't auto-populate the password field uising a database value.
> > Help. Thanx.
My guess is it's built into the design of the server control. It would
seem to be a security risk to allow prepopulating a password field.
Perhaps you could do a JavaScript kludge to work around it though if you
really had to.

Chris wrote:

>why is it that password fields:
><asp:TextBox Id="txtuserpassword1" TextMode="password" class="textbox" maxlength="20" Columns="15" Runat="Server" /><br>
>clear everytime validation kicks in or on page refreshes? Can this be stopped? Help!
>Also, I can't auto-populate the password field uising a database value.
>Help. Thanx.
asp.net clears password fields by default. to set the values in code behind
use the value attribute:

txtuserpassword1.Attributes.Add("value",myPassedValue);

-- bruce (sqlwork.com)

"Chris" <Chris@.discussions.microsoft.com> wrote in message
news:53BA7FBD-26A4-458A-BA32-0AB61190C1E6@.microsoft.com...
> why is it that password fields:
> <asp:TextBox Id="txtuserpassword1" TextMode="password" class="textbox"
maxlength="20" Columns="15" Runat="Server" /><br>
> clear everytime validation kicks in or on page refreshes? Can this be
stopped? Help!
> Also, I can't auto-populate the password field uising a database value.
> Help. Thanx.
This will work, but for security reasons, I would recommend not putting the
actual password value in there (as it can then become visible to the user if
they view source). Rather, I've often put in "********" as the value to
represent that something has been entered. The next time the user posts, if
that value matches, then I know they left it alone and the code responds
accordingly. Otherwise, they've made a change.

Ben Lucas
Lead Developer
Solien Technology, Inc.

"bruce barker" <nospam_brubar@.safeco.com> wrote in message
news:OOApwjbbEHA.368@.TK2MSFTNGP10.phx.gbl...
> asp.net clears password fields by default. to set the values in code
behind
> use the value attribute:
> txtuserpassword1.Attributes.Add("value",myPassedValue);
> -- bruce (sqlwork.com)
> "Chris" <Chris@.discussions.microsoft.com> wrote in message
> news:53BA7FBD-26A4-458A-BA32-0AB61190C1E6@.microsoft.com...
> > why is it that password fields:
> > <asp:TextBox Id="txtuserpassword1" TextMode="password" class="textbox"
> maxlength="20" Columns="15" Runat="Server" /><br>
> > clear everytime validation kicks in or on page refreshes? Can this be
> stopped? Help!
> > Also, I can't auto-populate the password field uising a database value.
> > Help. Thanx.

Password Fields

All,

We're trying to determine how to deal with password fields losing their
state on a post back.

We've got a form that implements post backs to carry out server side
processing. As a result of the post back, passwords entered by the user
lose their values and the user gets an error message upon final validation
when they submit. Here's an illustration

1. Password : [ ]
2. Confirm: [ ]
3. Select something from a list: [ ] // this could cause a
post-back, which wipes out the passwords
4. Some other field: [ ]
5. Hit submit key

After hitting the submit key (5), the user gets an error message, because
the passwords are now blank as a result of the post back in step #3. What
techniques should be used to get around this? We've tried fiddling with
the VIEWSTATE, to remember values, but it seems like their should be better
way... (?)

-- dwaTextbox of type password are cleared by design after postback. There are ways to get around it using Javascript but it's not a safe/secure thing to do

Suresh

-- dwa wrote: --

All

We're trying to determine how to deal with password fields losing thei
state on a post back

We've got a form that implements post backs to carry out server sid
processing. As a result of the post back, passwords entered by the use
lose their values and the user gets an error message upon final validatio
when they submit. Here's an illustratio

1. Password : [
2. Confirm: [
3. Select something from a list: [ ] // this could cause
post-back, which wipes out the password
4. Some other field: [
5. Hit submit ke

After hitting the submit key (5), the user gets an error message, becaus
the passwords are now blank as a result of the post back in step #3. Wha
techniques should be used to get around this? We've tried fiddling wit
the VIEWSTATE, to remember values, but it seems like their should be bette
way... (?

-- dw
Look at it from a security standpoint, if you restored the password, any joe
could look at the source and see the password in cleartext (not like it
isn't transfered that way). If it makes you feel any better, every site
I've come across doesn't save my password across postbacks. Yeah it's
annoying, but probably best way for security reasons. If you do want to
restore it, I'm sure the method you are using works great. If you want to
do it automatically you'll probably have to do some funky
inheritance/overriding of whatever method that matches posted values to
their respective form fields, which probably wouldn't even be worth it (and
I wouldn't even know where to begin)

"dwa" <da@.hotmail.com> wrote in message
news:%238rsyGy%23DHA.3496@.TK2MSFTNGP10.phx.gbl...
> All,
> We're trying to determine how to deal with password fields losing their
> state on a post back.
> We've got a form that implements post backs to carry out server side
> processing. As a result of the post back, passwords entered by the user
> lose their values and the user gets an error message upon final validation
> when they submit. Here's an illustration
> 1. Password : [ ]
> 2. Confirm: [ ]
> 3. Select something from a list: [ ] // this could cause a
> post-back, which wipes out the passwords
> 4. Some other field: [ ]
> 5. Hit submit key
> After hitting the submit key (5), the user gets an error message, because
> the passwords are now blank as a result of the post back in step #3.
What
> techniques should be used to get around this? We've tried fiddling
with
> the VIEWSTATE, to remember values, but it seems like their should be
better
> way... (?)
> -- dwa
Suresh,

I understand the security concerns. Nevertheless, can you point us to one
of those javascript examples?

Thanks,

-- dwa

"Suresh" <anonymous@.discussions.microsoft.com> wrote in message
news:961AEBCE-240A-43CF-B466-E31A6AED72E4@.microsoft.com...
> Textbox of type password are cleared by design after postback. There are
ways to get around it using Javascript but it's not a safe/secure thing to
do.
> Suresh.
> -- dwa wrote: --
> All,
> We're trying to determine how to deal with password fields losing
their
> state on a post back.
> We've got a form that implements post backs to carry out server side
> processing. As a result of the post back, passwords entered by the
user
> lose their values and the user gets an error message upon final
validation
> when they submit. Here's an illustration
> 1. Password : [ ]
> 2. Confirm: [ ]
> 3. Select something from a list: [ ] // this could cause
a
> post-back, which wipes out the passwords
> 4. Some other field: [ ]
> 5. Hit submit key
> After hitting the submit key (5), the user gets an error message,
because
> the passwords are now blank as a result of the post back in step #3.
What
> techniques should be used to get around this? We've tried
fiddling with
> the VIEWSTATE, to remember values, but it seems like their should be
better
> way... (?)
> -- dwa
I understand the security concerns.

I have seens sites that do this (asp.net sites if memory serves)

So it's being done... which means that some people want to override the
security issue in favor of improved form behavior. Plus, the security
issue is there regardless of the postback, but that's another story...

Darn!

-- dwa

"Raterus" <raterus@.localhost> wrote in message
news:OCA2PXy%23DHA.792@.TK2MSFTNGP11.phx.gbl...
> Look at it from a security standpoint, if you restored the password, any
joe
> could look at the source and see the password in cleartext (not like it
> isn't transfered that way). If it makes you feel any better, every site
> I've come across doesn't save my password across postbacks. Yeah it's
> annoying, but probably best way for security reasons. If you do want to
> restore it, I'm sure the method you are using works great. If you want to
> do it automatically you'll probably have to do some funky
> inheritance/overriding of whatever method that matches posted values to
> their respective form fields, which probably wouldn't even be worth it
(and
> I wouldn't even know where to begin)
>
> "dwa" <da@.hotmail.com> wrote in message
> news:%238rsyGy%23DHA.3496@.TK2MSFTNGP10.phx.gbl...
> > All,
> > We're trying to determine how to deal with password fields losing their
> > state on a post back.
> > We've got a form that implements post backs to carry out server side
> > processing. As a result of the post back, passwords entered by the
user
> > lose their values and the user gets an error message upon final
validation
> > when they submit. Here's an illustration
> > 1. Password : [ ]
> > 2. Confirm: [ ]
> > 3. Select something from a list: [ ] // this could cause a
> > post-back, which wipes out the passwords
> > 4. Some other field: [ ]
> > 5. Hit submit key
> > After hitting the submit key (5), the user gets an error message,
because
> > the passwords are now blank as a result of the post back in step #3.
> What
> > techniques should be used to get around this? We've tried fiddling
> with
> > the VIEWSTATE, to remember values, but it seems like their should be
> better
> > way... (?)
> > -- dwa
Here you go

Instead of a asp:textbox use html input box of type password and set it to runat server like below

<INPUT id="htxtPWD" type="password" runat="server"

Then in your handler that handles the postback of your dropdown list add the following code

string sJs = "<script language=\"javascript\">\n"
"<!--\n"
"document.myTestForm.htxtPWD.value = \"" + htxtPWD.Value + "\";"
"//-->\n"
"</script>\n"

Page.RegisterStartupScript("", sJs)

NOTE: This WILL leave the password exposed in the source of the HTML file

HTH
Suresh

-- dwa wrote: --

Suresh

I understand the security concerns. Nevertheless, can you point us to on
of those javascript examples

Thanks

-- dw

"Suresh" <anonymous@.discussions.microsoft.com> wrote in messag
news:961AEBCE-240A-43CF-B466-E31A6AED72E4@.microsoft.com..
> Textbox of type password are cleared by design after postback. There ar
ways to get around it using Javascript but it's not a safe/secure thing t
do
>> Suresh
>> -- dwa wrote: --
>> All
>> We're trying to determine how to deal with password fields losin
thei
> state on a post back
>> We've got a form that implements post backs to carry out server sid
> processing. As a result of the post back, passwords entered by th
use
> lose their values and the user gets an error message upon fina
validatio
> when they submit. Here's an illustratio
>> 1. Password : [
> 2. Confirm: [
> 3. Select something from a list: [ ] // this could caus

> post-back, which wipes out the password
> 4. Some other field: [
> 5. Hit submit ke
>> After hitting the submit key (5), the user gets an error message
becaus
> the passwords are now blank as a result of the post back in step #3
Wha
> techniques should be used to get around this? We've trie
fiddling wit
> the VIEWSTATE, to remember values, but it seems like their should b
bette
> way... (?
>> -- dw
>>>
You can use JavaScript to do this task,

private void RegisterPasswordScript()
{
string pw= LoadPW();

StringBuilder sb = new StringBuilder();
sb.Append("<script type=text/javascript language=javascript>\n");
sb.Append("\tfunction FillPassword()\n");
sb.Append("\t{\n");

sb.Append("\t\tdocument.all[\""+_passwordTexBox1.ClientID+"\"].value=\""+pw+
"\"\n");

sb.Append("\t\tdocument.all[\""+_passwordTexBox2.ClientID+"\"].value=\""+pw+
"\"\n");
sb.Append("\t}\n");
sb.Append("\t</script>");
this.RegisterStartupScript("PWSCRIPT",sb.ToString());
}

and call this for example in Page_Load(). You should encrypt the password
before integrating it into the Script.

You have to inlcude <body onload="javascript:FillPassword();"
Hope this is what you want.

Ci@.o Jens

"dwa" <da@.hotmail.com> schrieb im Newsbeitrag
news:%238rsyGy%23DHA.3496@.TK2MSFTNGP10.phx.gbl...
> All,
> We're trying to determine how to deal with password fields losing their
> state on a post back.
> We've got a form that implements post backs to carry out server side
> processing. As a result of the post back, passwords entered by the user
> lose their values and the user gets an error message upon final validation
> when they submit. Here's an illustration
> 1. Password : [ ]
> 2. Confirm: [ ]
> 3. Select something from a list: [ ] // this could cause a
> post-back, which wipes out the passwords
> 4. Some other field: [ ]
> 5. Hit submit key
> After hitting the submit key (5), the user gets an error message, because
> the passwords are now blank as a result of the post back in step #3.
What
> techniques should be used to get around this? We've tried fiddling
with
> the VIEWSTATE, to remember values, but it seems like their should be
better
> way... (?)
> -- dwa
Thanks Suresh.

So basically, we're injecting some code to reinitialize the value explicitly
after the postback.

We'll give it a go.

-- dwa

"Suresh" <anonymous@.discussions.microsoft.com> wrote in message
news:6A9E6D25-5FF9-4233-84FB-3A2371F069E4@.microsoft.com...
> Here you go:
> Instead of a asp:textbox use html input box of type password and set it to
runat server like below.
> <INPUT id="htxtPWD" type="password" runat="server">
> Then in your handler that handles the postback of your dropdown list add
the following code.
> string sJs = "<script language=\"javascript\">\n" +
> "<!--\n" +
> "document.myTestForm.htxtPWD.value = \"" + htxtPWD.Value + "\";" +
> "//-->\n" +
> "</script>\n";
> Page.RegisterStartupScript("", sJs);
> NOTE: This WILL leave the password exposed in the source of the HTML file.
> HTH,
> Suresh.
>
> -- dwa wrote: --
> Suresh,
> I understand the security concerns. Nevertheless, can you point us
to one
> of those javascript examples?
> Thanks,
> -- dwa
> "Suresh" <anonymous@.discussions.microsoft.com> wrote in message
> news:961AEBCE-240A-43CF-B466-E31A6AED72E4@.microsoft.com...
> > Textbox of type password are cleared by design after postback.
There are
> ways to get around it using Javascript but it's not a safe/secure
thing to
> do.
> >> Suresh.
> >> -- dwa wrote: --
> >> All,
> >> We're trying to determine how to deal with password fields
losing
> their
> > state on a post back.
> >> We've got a form that implements post backs to carry out
server side
> > processing. As a result of the post back, passwords entered
by the
> user
> > lose their values and the user gets an error message upon
final
> validation
> > when they submit. Here's an illustration
> >> 1. Password : [ ]
> > 2. Confirm: [ ]
> > 3. Select something from a list: [ ] // this could
cause
> a
> > post-back, which wipes out the passwords
> > 4. Some other field: [ ]
> > 5. Hit submit key
> >> After hitting the submit key (5), the user gets an error
message,
> because
> > the passwords are now blank as a result of the post back in
step #3.
> What
> > techniques should be used to get around this? We've tried
> fiddling with
> > the VIEWSTATE, to remember values, but it seems like their
should be
> better
> > way... (?)
> >> -- dwa
> >>
Jens,

Looks pretty close to the suggestion from Suresh. So by majority vote,
we'll try it out.

Thanks,

-- dwa

"Jens Hofmann" <bully01@.gmx.de> wrote in message
news:403bf91b$0$28971$9b4e6d93@.newsread2.arcor-online.net...
> You can use JavaScript to do this task,
>
> private void RegisterPasswordScript()
> {
> string pw= LoadPW();
> StringBuilder sb = new StringBuilder();
> sb.Append("<script type=text/javascript language=javascript>\n");
> sb.Append("\tfunction FillPassword()\n");
> sb.Append("\t{\n");
>
sb.Append("\t\tdocument.all[\""+_passwordTexBox1.ClientID+"\"].value=\""+pw+
> "\"\n");
>
sb.Append("\t\tdocument.all[\""+_passwordTexBox2.ClientID+"\"].value=\""+pw+
> "\"\n");
> sb.Append("\t}\n");
> sb.Append("\t</script>");
> this.RegisterStartupScript("PWSCRIPT",sb.ToString());
> }
> and call this for example in Page_Load(). You should encrypt the password
> before integrating it into the Script.
> You have to inlcude <body onload="javascript:FillPassword();">
> Hope this is what you want.
> Ci@.o Jens
>
> "dwa" <da@.hotmail.com> schrieb im Newsbeitrag
> news:%238rsyGy%23DHA.3496@.TK2MSFTNGP10.phx.gbl...
> > All,
> > We're trying to determine how to deal with password fields losing their
> > state on a post back.
> > We've got a form that implements post backs to carry out server side
> > processing. As a result of the post back, passwords entered by the
user
> > lose their values and the user gets an error message upon final
validation
> > when they submit. Here's an illustration
> > 1. Password : [ ]
> > 2. Confirm: [ ]
> > 3. Select something from a list: [ ] // this could cause a
> > post-back, which wipes out the passwords
> > 4. Some other field: [ ]
> > 5. Hit submit key
> > After hitting the submit key (5), the user gets an error message,
because
> > the passwords are now blank as a result of the post back in step #3.
> What
> > techniques should be used to get around this? We've tried fiddling
> with
> > the VIEWSTATE, to remember values, but it seems like their should be
> better
> > way... (?)
> > -- dwa

Password Fields

Does any one know how to put text into a password field.> Does any one know how to put text into a password field.

Same as any other text field... < ... value="hello world" ...
> Same as any other text field... < ... value="hello world" ...
I've got it sussed now, thanks.

You idea did not work, although the text property is set, it does not
display it. Its neccessary to set the text property, and use

txtBox.Attributes.Add("Value",someString)

With both set it displays the asterisks and stores the Text value.
Setting the Text property of the password-mode text box may not work. You
have to use the Attributes collection of the textbox.

txtPwd.Text = "mypwd"; // This will not pre-populate the password field
txtPwd.Attributes.Add ("VALUE", "mypwd"); // but this will...

However, sending a default password is not recommended.

HTH

"Josh" <someone@.microsoft.com> wrote in message
news:OVD$hDtpEHA.1160@.tk2msftngp13.phx.gbl...
Does any one know how to put text into a password field.

password fields

why is it that password fields:
<asp:TextBox Id="txtuserpassword1" TextMode="password" class="textbox" maxle
ngth="20" Columns="15" Runat="Server" /><br>
clear everytime validation kicks in or on page refreshes? Can this be stoppe
d? Help!
Also, I can't auto-populate the password field uising a database value.
Help. Thanx.This is the default behavior. If password fields were to refresh, they would
have to be stored in ViewState. Since ViewState is stored on the HTML rende
red to the browser, the user can easily do a view source and have access to
the password. This defeats
the purpose of having the password masked.
There is no way to override this, unless you make a custom control, or some
other work around.
hope this helps,
John
"Chris" wrote:

> why is it that password fields:
> <asp:TextBox Id="txtuserpassword1" TextMode="password" class="textbox" max
length="20" Columns="15" Runat="Server" /><br>
> clear everytime validation kicks in or on page refreshes? Can this be stop
ped? Help!
> Also, I can't auto-populate the password field uising a database value.
> Help. Thanx.
>
ok, I can buy the "refresh" reason but what about setting to a value via a d
atabase call:
txtuserpassword1.Text = "" & memberdata("USER_PASSWORD")
txtuserpassword2.Text = "" & memberdata("USER_PASSWORD")
they won't populate, why?
thanx.
"John Sivilla" wrote:

> This is the default behavior. If password fields were to refresh, they would have
to be stored in ViewState. Since ViewState is stored on the HTML rendered to the bro
wser, the user can easily do a view source and have access to the password. This def
eat
s the purpose of having the password masked.
> There is no way to override this, unless you make a custom control, or som
e other work around.
> hope this helps,
> John
> "Chris" wrote:
>
My guess is it's built into the design of the server control. It would
seem to be a security risk to allow prepopulating a password field.
Perhaps you could do a JavaScript kludge to work around it though if you
really had to.
Chris wrote:

>why is it that password fields:
><asp:TextBox Id="txtuserpassword1" TextMode="password" class="textbox" maxl
ength="20" Columns="15" Runat="Server" /><br>
>clear everytime validation kicks in or on page refreshes? Can this be stopp
ed? Help!
>Also, I can't auto-populate the password field uising a database value.
>Help. Thanx.
>
>
asp.net clears password fields by default. to set the values in code behind
use the value attribute:
txtuserpassword1.Attributes.Add("value",myPassedValue);
-- bruce (sqlwork.com)
"Chris" <Chris@.discussions.microsoft.com> wrote in message
news:53BA7FBD-26A4-458A-BA32-0AB61190C1E6@.microsoft.com...
> why is it that password fields:
> <asp:TextBox Id="txtuserpassword1" TextMode="password" class="textbox"
maxlength="20" Columns="15" Runat="Server" /><br>
> clear everytime validation kicks in or on page refreshes? Can this be
stopped? Help!
> Also, I can't auto-populate the password field uising a database value.
> Help. Thanx.
>
This will work, but for security reasons, I would recommend not putting the
actual password value in there (as it can then become visible to the user if
they view source). Rather, I've often put in "********" as the value to
represent that something has been entered. The next time the user posts, if
that value matches, then I know they left it alone and the code responds
accordingly. Otherwise, they've made a change.
Ben Lucas
Lead Developer
Solien Technology, Inc.
"bruce barker" <nospam_brubar@.safeco.com> wrote in message
news:OOApwjbbEHA.368@.TK2MSFTNGP10.phx.gbl...
> asp.net clears password fields by default. to set the values in code
behind
> use the value attribute:
> txtuserpassword1.Attributes.Add("value",myPassedValue);
> -- bruce (sqlwork.com)
> "Chris" <Chris@.discussions.microsoft.com> wrote in message
> news:53BA7FBD-26A4-458A-BA32-0AB61190C1E6@.microsoft.com...
> maxlength="20" Columns="15" Runat="Server" /><br>
> stopped? Help!
>
does the trick, thanx a lot!
"bruce barker" wrote:

> asp.net clears password fields by default. to set the values in code behin
d
> use the value attribute:
> txtuserpassword1.Attributes.Add("value",myPassedValue);
> -- bruce (sqlwork.com)
> "Chris" <Chris@.discussions.microsoft.com> wrote in message
> news:53BA7FBD-26A4-458A-BA32-0AB61190C1E6@.microsoft.com...
> maxlength="20" Columns="15" Runat="Server" /><br>
> stopped? Help!
>
>
good suggestions, I never thought of that!
"Ben Lucas" wrote:

> This will work, but for security reasons, I would recommend not putting th
e
> actual password value in there (as it can then become visible to the user
if
> they view source). Rather, I've often put in "********" as the value to
> represent that something has been entered. The next time the user posts,
if
> that value matches, then I know they left it alone and the code responds
> accordingly. Otherwise, they've made a change.
> Ben Lucas
> Lead Developer
> Solien Technology, Inc.
> "bruce barker" <nospam_brubar@.safeco.com> wrote in message
> news:OOApwjbbEHA.368@.TK2MSFTNGP10.phx.gbl...
> behind
>
>

Password Fields Lose Value During PostBack

I have a form, and when the form does a PostBack (I have several areas on
the form where the form changes if the user selects a different
RadioButton), the Password field is cleared, even though I have
EnableViewState set to True. None of the other TextBoxes lose their value. I
also tried using Session variables to store the value between postbacks, but
I must be doing this in the wrong event, because it does not seem to be
having an effect. What can I do to prevent the Password field from losing
it's value? Thanks.
--
Nathan Sokalski
njsokalski@dotnet.itags.org.hotmail.com
http://www.nathansokalski.com/This is a security feature. So the password isn't sent down to the browser
in clear text.

The ViewState is just an encrypted version of what was last sent down, so
that next time there is a post to the server, it can all be sent back up as
one thing. It can then be used on the server, to see if a field's value
changed, etc.

The browser does not care about ViewState, and does not use it to populate
its controls.

There is no way to override the behavior. The only way you can do this, is
to do it in javascript, but that would most likely mean sending the password
down in clear text, where anyone who knows how to do View -> Source can look
at it.

"Nathan Sokalski" <njsokalski@.hotmail.com> wrote in message
news:%23mvV7GDeFHA.3328@.TK2MSFTNGP09.phx.gbl...
>I have a form, and when the form does a PostBack (I have several areas on
>the form where the form changes if the user selects a different
>RadioButton), the Password field is cleared, even though I have
>EnableViewState set to True. None of the other TextBoxes lose their value.
>I also tried using Session variables to store the value between postbacks,
>but I must be doing this in the wrong event, because it does not seem to be
>having an effect. What can I do to prevent the Password field from losing
>it's value? Thanks.
> --
> Nathan Sokalski
> njsokalski@.hotmail.com
> http://www.nathansokalski.com/
This is the default behavior. It minimizes passwords being transmitted
around the internet any more than they have to be. It's a security
precaution.

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 to fill in the
password. For reasons mentioned earlier, it's preferable to avoid
transmitting the password around like this when possible.

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net

"Nathan Sokalski" <njsokalski@.hotmail.com> wrote in message
news:%23mvV7GDeFHA.3328@.TK2MSFTNGP09.phx.gbl...
>I have a form, and when the form does a PostBack (I have several areas on
>the form where the form changes if the user selects a different
>RadioButton), the Password field is cleared, even though I have
>EnableViewState set to True. None of the other TextBoxes lose their value.
>I also tried using Session variables to store the value between postbacks,
>but I must be doing this in the wrong event, because it does not seem to be
>having an effect. What can I do to prevent the Password field from losing
>it's value? Thanks.
> --
> Nathan Sokalski
> njsokalski@.hotmail.com
> http://www.nathansokalski.com/

Password goes blank. When I make round trip to server

I have a simple Data Entry form that User enters some information....One of these fields is a password field...Now i have a textBox and and the TextMode is set to Password...but I am unable to save the password to the database cause when i check a check box who's AutoPostBack is set to true the text in textbox with its text mode set to password just goes back to being blank when the page reloads....I dont understand why...I am using ASP.Net 1.1 VS 03 and Sql Backend......I just want to be able to save my Passwords to the DB so that the user will be able to log in and I can authenicate him..........

More then likely you are blanking it in the Page_Load()

Ensure you have a:
If Not IsPostBack() then
... clear password
End if


I thought that but when I change the text mode to Single line...it works just fine....

I've seen the same behavior. I believe this is a security feature. You can use the following approach to work around it.

PrivateSub Page_PreRender(ByVal senderAsObject,ByVal eAs System.EventArgs)HandlesMyBase.PreRender

Password.Attributes.Add(

"value", Password.Text)

ConfirmPassword.Attributes.Add(

"value", ConfirmPassword.Text)EndSub