TextMode Property - asp:textbox
Messages   Related Types
This message was discovered on ASPFriends.com 'aspngfreeforall' list.


Paul Actis
I want to set an <asp:textbox> TextMode property to Password but also populate it with characters(so the user doesn't have to re-enter their password).
If I set the TextMode property to Password at design time and then try and set the Text property on my Page Load event, no characters appear.
If I try and set the TextMode property after setting the Text property, no characters appear:

txtPassword.Text = GetPassword()
txtPassword.TextMode = TextBoxMode.Password

When I do a watch(in debug) on the Text property the password does show up but it is not displayed(with the '*' character) on the page.

Any ideas would be greatly appreciated

Thanks
paul
Reply to this message...
 
    
Greg Quinn
Do this...In your Page_Load,

txtPassword.Attributes.Add("value", GetPassword().ToString())

Greg

-----Original Message-----
From: Paul Actis [mailto:Click here to reveal e-mail address]
Sent: Thursday, August 15, 2002 7:01 AM
To: aspngfreeforall
Subject: [aspngfreeforall] TextMode Property - asp:textbox

I want to set an <asp:textbox> TextMode property to Password but also
populate it with characters(so the user doesn’t have to re-enter their
password).

If I set the TextMode property to Password at design time and then try and
set the Text property on my Page Load event, no characters appear.

If I try and set the TextMode property after setting the Text property, no
characters appear:

txtPassword.Text = GetPassword()

txtPassword.TextMode = TextBoxMode.Password

When I do a watch(in debug) on the Text property the password does show up
but it is not displayed(with the ‘*’ character) on the page.

Any ideas would be greatly appreciated

Thanks

paul

| ASP.net DOCS = http://www.aspng.com/docs | [aspngfreeforall] member
Click here to reveal e-mail address = YOUR ID | http://www.asplists.com/aspngfreeforall JOIN/QUIT | news://ls.asplists.com = NEWSGROUP
Reply to this message...
 
    
Doug Nelson
While the response Greg gave will work, if a user does a view source on
the form, the password is visible as plain text and that is never good
from a security standpoint.

Rather, I would use Viewstate to hold the password value and if the user
doesn't change it then retrieve the value from view state.

In the page load event
ViewState["OrigPassword"] = userpassword.toString();

Password.Attributes.Add("value","**********")

In the postback (however you are doing it)

If(Password.Text != "**********")
ViewState["OrigPassword"] = Password.Text;

Then use the view state value in your update.

Hope this helps.

-----Original Message-----
From: Paul Actis [mailto:Click here to reveal e-mail address]
Sent: Thursday, August 15, 2002 9:01 AM
To: aspngfreeforall
Subject: [aspngfreeforall] TextMode Property - asp:textbox

I want to set an <asp:textbox> TextMode property to Password but also
populate it with characters(so the user doesn't have to re-enter their
password).
If I set the TextMode property to Password at design time and then try
and set the Text property on my Page Load event, no characters appear.
If I try and set the TextMode property after setting the Text property,
no characters appear:

txtPassword.Text = GetPassword()
txtPassword.TextMode = TextBoxMode.Password

When I do a watch(in debug) on the Text property the password does show
up but it is not displayed(with the '*' character) on the page.

Any ideas would be greatly appreciated

Thanks
paul

| ASP.net DOCS = http://www.aspng.com/docs | [aspngfreeforall] member
Click here to reveal e-mail address = YOUR ID |
http://www.asplists.com/aspngfreeforall = JOIN/QUIT |
news://ls.asplists.com = NEWSGROUP
Reply to this message...
 
    
Greg Quinn
What I have done is encrypt the password at INSERT time into the database,
then if the user views the source he/she will only view an encrypted
password anyway. This is also more secure in the sense that if someone gets
access to the users table they will still only see encrypted passwords, and
will this not be able to manipulate the system as easy.

Greg

-----Original Message-----
From: Doug Nelson [mailto:Click here to reveal e-mail address]
Sent: Thursday, August 15, 2002 7:39 AM
To: aspngfreeforall
Subject: [aspngfreeforall] RE: TextMode Property - asp:textbox

While the response Greg gave will work, if a user does a view source on
the form, the password is visible as plain text and that is never good from
a security standpoint.

Rather, I would use Viewstate to hold the password value and if the user
doesn't change it then retrieve the value from view state.

In the page load event

ViewState["OrigPassword"] = userpassword.toString();

Password.Attributes.Add("value","**********")

In the postback (however you are doing it)

If(Password.Text != "**********")

ViewState["OrigPassword"] = Password.Text;

Then use the view state value in your update.

Hope this helps.

-----Original Message-----
From: Paul Actis [mailto:Click here to reveal e-mail address]
Sent: Thursday, August 15, 2002 9:01 AM
To: aspngfreeforall
Subject: [aspngfreeforall] TextMode Property - asp:textbox

I want to set an <asp:textbox> TextMode property to Password but also
populate it with characters(so the user doesn't have to re-enter their
password).

If I set the TextMode property to Password at design time and then try and
set the Text property on my Page Load event, no characters appear.

If I try and set the TextMode property after setting the Text property, no
characters appear:

txtPassword.Text = GetPassword()

txtPassword.TextMode = TextBoxMode.Password

When I do a watch(in debug) on the Text property the password does show up
but it is not displayed(with the '*' character) on the page.

Any ideas would be greatly appreciated

Thanks

paul

| ASP.net DOCS = http://www.aspng.com/docs | [aspngfreeforall] member
Click here to reveal e-mail address = YOUR ID | http://www.asplists.com/aspngfreeforall JOIN/QUIT | news://ls.asplists.com = NEWSGROUP

| ASP.net DOCS = http://www.aspng.com/docs | [aspngfreeforall] member
Click here to reveal e-mail address = YOUR ID | http://www.asplists.com/aspngfreeforall JOIN/QUIT | news://ls.asplists.com = NEWSGROUP
Reply to this message...
 
 
System.Web.UI.WebControls.TextBoxMode




Ad
MBR BootFX
Best-of-breed application framework for .NET projects, developed by Matthew Baxter-Reynolds and MBR IT
 
 Copyright © Matthew Baxter-Reynolds 2001-2008. '.NET 247 Software Development Services' is a trading style of MBR IT Solutions Ltd.
Contact Us - Terms of Use - Privacy Policy - www.dotnet247.com