473,383 Members | 2,005 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

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
nj********@hotmail.com
http://www.nathansokalski.com/
Nov 19 '05 #1
2 2686
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" <nj********@hotmail.com> wrote in message
news:%2****************@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
nj********@hotmail.com
http://www.nathansokalski.com/

Nov 19 '05 #2
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" <nj********@hotmail.com> wrote in message
news:%2****************@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
nj********@hotmail.com
http://www.nathansokalski.com/

Nov 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: ChInKPoInt [No MCSD] | last post by:
1. Is there anyway to preload password? Text attribute doesn't work <asp:TextBox ID="Pass" TextMode="Password" Runat="server" Text="Hello"> 2. In the same form, if other elements such as...
8
by: dwa | last post by:
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...
1
by: dwa | last post by:
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...
4
by: J Sahoo | last post by:
Hello, I have a registration page where I am collecting user information (username, password, last name, age, etc...). I made the password field as PASSWORD (field type from the textbox). If user...
7
by: Simon Harvey | last post by:
Hi all, Can anyone help me with the following: I have a page that has a couple of password fields - txtPassword and txtConfirmPassword I also have a need on this page to do postbacks and...
10
by: dana lees | last post by:
Hello, I am developing a C# asp.net application. I have a webform which contains 2 dropdowns and a textbox with type="password". On "SelectedIndexChanged" event of the first dropdown, there is...
6
by: James | last post by:
Have a textbox that's in Password mode on a user creation page. Have several dropdowns that cause a PostBack out of necessity on this page. I cannot separate them. When one of these dropdowns...
2
by: ganapathybabu | last post by:
I've used passwordfields, the form is being postback several times during change event of DropDownList.During that time the password textboxes are getting cleared making the user to input the...
1
by: jqheller | last post by:
Folks I am losing my mind trying to work with the TemplatedWizardStep. I have created a multistep user registration form that collects plenty of user information including a password. At the end...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.