Dave Burke - Freelance .NET Developer specializing in Online Communities

A freelance .NET Developer

Populating a password textbox

Learned today that ASP.NET textboxes with textmode=password cannot be populated as in .ASP.  (I almost said “as in classic .ASP.”  There was nothing classic about .ASP.  It's not friggen' Coke or anything.)  So no

txtPassword.text = cookie.Values[”password”];

I appreciate the security implications of pre-populating and sending a password as clear text, but in this particular app, “it ain't a problem.”

Found a fun client-side workaround.

txtPassword.Attributes.Add(”value”, cookie.Values[”password”])

Posted: Mar 14 2004, 05:09 PM by daveburke | with 4 comment(s)
Filed under:

Comments

CK said:

I'm not sure that everyone understands the implacation of using your example. The drawback to this method of filling a password textbox is that if the user views the page source, they can also see the password in plain text. Kind of defeats the purpose of those asterisks if you ask me. A better way is to use the Viewstate method and keep the password in memory on the server.
# June 24, 2004 4:25 PM

Dave Burke said:

Thanks, CK. I'll look into this. Since the site is a church site, its not an issue, but I'm very glad you mentioned this for situations where this is not a, uh, best practice. Regards!
# June 24, 2004 5:11 PM

blanco said:

Perfect

It works

thx a lot

# May 30, 2007 8:48 AM

Buffy said:

Thanks for the tip, I thought I had programmed something wrong.

# December 6, 2010 10:33 AM
Leave a Comment

(required) 

(required) 

(optional)

(required)