473,395 Members | 1,815 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,395 software developers and data experts.

How to retain the PASSWORD field values during postback?

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 leaves any
field and presses the SUBMIT button, Then the edit checks are
performed and if any Error occurs I show the error messge, (a
postBack occured), now I loose the value of the password (what the
user had entered) the password field is RESETed (blank).

So how do I keep the value of the password in each postback without
reseting? Otherwise user has to enter the password again and again
(everytime an error occurs or postback occurs).

Thank you.

Sahoo J
Nov 18 '05 #1
4 8249
Short answer is, you don't. Persisting a password field is a security hole.
In fact, if you use your browser's back button to go back to a page that has
a password field in it, the value will be blank, even on the client. I would
recommend storing it in Session or something like that on the server.

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

"J Sahoo" <sa***@mississippi.org> wrote in message
news:24*************************@posting.google.co m...
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 leaves any
field and presses the SUBMIT button, Then the edit checks are
performed and if any Error occurs I show the error messge, (a
postBack occured), now I loose the value of the password (what the
user had entered) the password field is RESETed (blank).

So how do I keep the value of the password in each postback without
reseting? Otherwise user has to enter the password again and again
(everytime an error occurs or postback occurs).

Thank you.

Sahoo J

Nov 18 '05 #2
in the code behind

password.Attributes["value"] = password.Text;

-- bruce (sqlwork.com)
"J Sahoo" <sa***@mississippi.org> wrote in message
news:24*************************@posting.google.co m...
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 leaves any
field and presses the SUBMIT button, Then the edit checks are
performed and if any Error occurs I show the error messge, (a
postBack occured), now I loose the value of the password (what the
user had entered) the password field is RESETed (blank).

So how do I keep the value of the password in each postback without
reseting? Otherwise user has to enter the password again and again
(everytime an error occurs or postback occurs).

Thank you.

Sahoo J

Nov 18 '05 #3
this is normal behaviour, but here is a good reply from a previous post:

------------

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


"J Sahoo" <sa***@mississippi.org> wrote in message
news:24*************************@posting.google.co m...
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 leaves any
field and presses the SUBMIT button, Then the edit checks are
performed and if any Error occurs I show the error messge, (a
postBack occured), now I loose the value of the password (what the
user had entered) the password field is RESETed (blank).

So how do I keep the value of the password in each postback without
reseting? Otherwise user has to enter the password again and again
(everytime an error occurs or postback occurs).

Thank you.

Sahoo J

Nov 18 '05 #4
Read the value during postback and dump the value back to the control
during onPreRender.
Nov 18 '05 #5

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

Similar topics

1
by: chambersdon | last post by:
I have created a Web Custom Control that inherits from WebControls.ListBox but can't get it to retain the selectedIndex after a postback. As a test I created a very simple version of the control...
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...
1
by: Richard Dixson | last post by:
Under ASP.NET (C#) I want to create a page that people can use to submit questions. This page will consist of a table with several rows of information, like: Name: Bill Smith Job title:...
2
by: Richard Dixson | last post by:
Under ASP.NET (C#) I want to create a page that people can use to submit questions. This page will consist of a table with several rows of information, like: Name: Bill Smith Job title:...
1
by: CS Wong | last post by:
Hi, I have a page form where form elements are created dynamically using Javascript instead of programatically at the code-behind level. I have problems accessing the dynamically-created...
2
by: Nathan Sokalski | last post by:
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...
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...
1
by: Scott H | last post by:
I have a page with several server controls placed on there at design time, including a blank table control. During runtime I add some controls to the table, including some checkboxes, which I...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.