Click here to Skip to main content
15,888,579 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
i have a problem here..hope anyvody can try to sol it for me...
i am using VS2010 ....i am trying to create a registration page.
I have following controls to register

1) email id(textbox)
2) password(textbox)
3) re-enter password(textbox)
4) security question drop-down list(autopostback =true)

In this DDlist, when ever i choose 'set your own question', a new textbox appears.
However when the page posts back, the password written in the password text gets disappeared.....

What did i tried :
1) tried to save the password text in session...no joy..

please help..job in danger...thx
Posted
Updated 6-May-11 6:44am
v2

Whatever you do, never save password anywhere! This is unsafe. Through a postback, the unencrypted password goes through network. This is dangerous enough.

(I hope you also understand the password should not be stored anywhere. You don't need a password itself for authentication as you can always compare its encrypted a hashed form which can be stored on the server.)

—SA
 
Share this answer
 
Comments
Albin Abel 7-May-11 17:16pm    
I think my vote can transit through wire/ wireless.
Sergey Alexandrovich Kryukov 7-May-11 20:03pm    
Thank you. It could. :-)
--SA
I think you can make autopostback=false;
try this:

this.EditButton.Attributes["onClick"] = "return false;";

this may help u
 
Share this answer
 
By default the password control can't save its value between postbacks
use the following way.

Just add the line txtPassword.Attributes.Add("Value", txtPassword.Text) to the button click event that trigger the postback and now is working.

-happy programming
 
Share this answer
 
try this

VB
In Page_Load (not under a IsPostback check)
ViewState("_Pass") = tbPassword.Text
In Page_PreRender
tbPassword.Attributes.Add("value", ViewState("_Pass"))

/* read this link also */
Click[^]
 
Share this answer
 
Actually it happens when ur textbox textmode="Password" on postback

Why u r showing textbox from server side.
U can show textbox from javascript also using onchange event of dropdownlist

see this link

http://forums.asp.net/t/1224793.aspx/1?Javascript+for+onchange+event+in+asp+dropdownlist[^]

It solves ur problem
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900