By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,302 Members | 3,621 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,302 IT Pros & Developers. It's quick & easy.

Help needed in ASP.Net 2.0 Text Box Password Mode

P: n/a
hi all,
i am running a ASP.Net 2.0 application.
in one of the pages i have a text box which is set as PASSWORD mode.
when the page is submitted or transfered , am not able to get the contents
of this textbox which is in Password mode.

do we need to any more apart from setting to password mode to get the value
present in the text box..?

do we need to do anything in specific with the viewstates if there is
security with ASP.Net Password text boxes?

Please let me know

Thanks
Senthil
Aug 21 '07 #1
Share this Question
Share on Google+
6 Replies


P: n/a
A password box acts as normal, are you referring to the fact that the box
isn't pre-populated after a postback? If so then add a VALUE attribute to
it with the value of txtYourPasswordBox.Text

"SenthilVel" <se******************@misyshealthcare.comwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
hi all,
i am running a ASP.Net 2.0 application.
in one of the pages i have a text box which is set as PASSWORD mode.
when the page is submitted or transfered , am not able to get the contents
of this textbox which is in Password mode.

do we need to any more apart from setting to password mode to get the
value present in the text box..?

do we need to do anything in specific with the viewstates if there is
security with ASP.Net Password text boxes?

Please let me know

Thanks
Senthil

Aug 21 '07 #2

P: n/a
Is your password textbox created programatically?
Check this.

As Aidy said, this can be about PostBack problems. For example in your
Page_Load code

protected void Page_Load(object sender, EventArgs e)
{
// .. some other c# codes
txtPassword.Text = "";
// .. some other c# codes
}
When postback the current value will be lost, so you have to control it like
protected void Page_Load(object sender, EventArgs e)
{
// .. some other c# codes
if(!Page.IsPostBack)
txtPassword.Text = "";
// .. some other c# codes
}

"SenthilVel" <se******************@misyshealthcare.com>, iletisinde şunu
yazdı, news:%2****************@TK2MSFTNGP04.phx.gbl...
hi all,
i am running a ASP.Net 2.0 application.
in one of the pages i have a text box which is set as PASSWORD mode.
when the page is submitted or transfered , am not able to get the contents
of this textbox which is in Password mode.

do we need to any more apart from setting to password mode to get the
value present in the text box..?

do we need to do anything in specific with the viewstates if there is
security with ASP.Net Password text boxes?

Please let me know

Thanks
Senthil

Aug 22 '07 #3

P: n/a
hi
thanks for the info ...
question:
to get the value of the password textbox , do we set the value in the
Viewstate ? and then assign to the Value Attribute ?

Please let me know step by step ..

,,,
Senthil
"Bahadır ARSLAN" <ba************@netron.com.trwrote in message
news:F0**********************************@microsof t.com...
Is your password textbox created programatically?
Check this.

As Aidy said, this can be about PostBack problems. For example in your
Page_Load code

protected void Page_Load(object sender, EventArgs e)
{
// .. some other c# codes
txtPassword.Text = "";
// .. some other c# codes
}
When postback the current value will be lost, so you have to control it
like
protected void Page_Load(object sender, EventArgs e)
{
// .. some other c# codes
if(!Page.IsPostBack)
txtPassword.Text = "";
// .. some other c# codes
}

"SenthilVel" <se******************@misyshealthcare.com>, iletisinde şunu
yazdı, news:%2****************@TK2MSFTNGP04.phx.gbl...
>hi all,
i am running a ASP.Net 2.0 application.
in one of the pages i have a text box which is set as PASSWORD mode.
when the page is submitted or transfered , am not able to get the
contents of this textbox which is in Password mode.

do we need to any more apart from setting to password mode to get the
value present in the text box..?

do we need to do anything in specific with the viewstates if there is
security with ASP.Net Password text boxes?

Please let me know

Thanks
Senthil


Aug 22 '07 #4

P: n/a
in one of the blogs i saw a solution like :

setting txtbox.attributes("value") = txtbox.text
this was added in the preresender event of the text box...

Question: Is this a limitation with the textbox that we need to this step
maunally ?
is this a security feature ?

,,,
Senthil
"SenthilVel" <se******************@misyshealthcare.comwrote in message
news:Ou**************@TK2MSFTNGP06.phx.gbl...
hi
thanks for the info ...
question:
to get the value of the password textbox , do we set the value in the
Viewstate ? and then assign to the Value Attribute ?

Please let me know step by step ..

,,,
Senthil
"Bahadır ARSLAN" <ba************@netron.com.trwrote in message
news:F0**********************************@microsof t.com...
>Is your password textbox created programatically?
Check this.

As Aidy said, this can be about PostBack problems. For example in your
Page_Load code

protected void Page_Load(object sender, EventArgs e)
{
// .. some other c# codes
txtPassword.Text = "";
// .. some other c# codes
}
When postback the current value will be lost, so you have to control it
like
protected void Page_Load(object sender, EventArgs e)
{
// .. some other c# codes
if(!Page.IsPostBack)
txtPassword.Text = "";
// .. some other c# codes
}

"SenthilVel" <se******************@misyshealthcare.com>, iletisinde şunu
yazdı, news:%2****************@TK2MSFTNGP04.phx.gbl...
>>hi all,
i am running a ASP.Net 2.0 application.
in one of the pages i have a text box which is set as PASSWORD mode.
when the page is submitted or transfered , am not able to get the
contents of this textbox which is in Password mode.

do we need to any more apart from setting to password mode to get the
value present in the text box..?

do we need to do anything in specific with the viewstates if there is
security with ASP.Net Password text boxes?

Please let me know

Thanks
Senthil



Aug 22 '07 #5

P: n/a
Hi,

No we don't need to set viewstate.
If you have a textbox like this

<asp:TextBox id="txtPass" runat="server" TextMode="Password" />

you can get its value by
txtPass.Text property.

You don't need to anything more..

"SenthilVel" <se******************@misyshealthcare.com>, iletisinde şunu
yazdı, news:Ou**************@TK2MSFTNGP06.phx.gbl...
hi
thanks for the info ...
question:
to get the value of the password textbox , do we set the value in the
Viewstate ? and then assign to the Value Attribute ?

Please let me know step by step ..

,,,
Senthil
"Bahadır ARSLAN" <ba************@netron.com.trwrote in message
news:F0**********************************@microsof t.com...
>Is your password textbox created programatically?
Check this.

As Aidy said, this can be about PostBack problems. For example in your
Page_Load code

protected void Page_Load(object sender, EventArgs e)
{
// .. some other c# codes
txtPassword.Text = "";
// .. some other c# codes
}
When postback the current value will be lost, so you have to control it
like
protected void Page_Load(object sender, EventArgs e)
{
// .. some other c# codes
if(!Page.IsPostBack)
txtPassword.Text = "";
// .. some other c# codes
}

"SenthilVel" <se******************@misyshealthcare.com>, iletisinde şunu
yazdı, news:%2****************@TK2MSFTNGP04.phx.gbl...
>>hi all,
i am running a ASP.Net 2.0 application.
in one of the pages i have a text box which is set as PASSWORD mode.
when the page is submitted or transfered , am not able to get the
contents of this textbox which is in Password mode.

do we need to any more apart from setting to password mode to get the
value present in the text box..?

do we need to do anything in specific with the viewstates if there is
security with ASP.Net Password text boxes?

Please let me know

Thanks
Senthil


Aug 22 '07 #6

P: n/a
hi,

i did the same way as u were saying ..just have the <asp:TextBox
id="txtPass" runat="server" TextMode="Password" />

But once a post back is happeining or when the value in the text boz is
accessed in a button click event , still the password is null !!

am not able to get the password value !!
do we need to do something like this ?

ViewState["Pwd"]=TextBox1.Text
TextBox1.Attributes.Add("value", ViewState["Pwd"].ToString ()) ;

,,,
Senthil

"Bahadır ARSLAN" <ba************@netron.com.trwrote in message
news:D6**********************************@microsof t.com...
Hi,

No we don't need to set viewstate.
If you have a textbox like this

<asp:TextBox id="txtPass" runat="server" TextMode="Password" />

you can get its value by
txtPass.Text property.

You don't need to anything more..

"SenthilVel" <se******************@misyshealthcare.com>, iletisinde şunu
yazdı, news:Ou**************@TK2MSFTNGP06.phx.gbl...
>hi
thanks for the info ...
question:
to get the value of the password textbox , do we set the value in the
Viewstate ? and then assign to the Value Attribute ?

Please let me know step by step ..

,,,
Senthil
"Bahadır ARSLAN" <ba************@netron.com.trwrote in message
news:F0**********************************@microso ft.com...
>>Is your password textbox created programatically?
Check this.

As Aidy said, this can be about PostBack problems. For example in your
Page_Load code

protected void Page_Load(object sender, EventArgs e)
{
// .. some other c# codes
txtPassword.Text = "";
// .. some other c# codes
}
When postback the current value will be lost, so you have to control it
like
protected void Page_Load(object sender, EventArgs e)
{
// .. some other c# codes
if(!Page.IsPostBack)
txtPassword.Text = "";
// .. some other c# codes
}

"SenthilVel" <se******************@misyshealthcare.com>, iletisinde şunu
yazdı, news:%2****************@TK2MSFTNGP04.phx.gbl...
hi all,
i am running a ASP.Net 2.0 application.
in one of the pages i have a text box which is set as PASSWORD mode.
when the page is submitted or transfered , am not able to get the
contents of this textbox which is in Password mode.

do we need to any more apart from setting to password mode to get the
value present in the text box..?

do we need to do anything in specific with the viewstates if there is
security with ASP.Net Password text boxes?

Please let me know

Thanks
Senthil


Aug 22 '07 #7

This discussion thread is closed

Replies have been disabled for this discussion.