Wrox Programmer Forums
|
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 13th, 2006, 08:22 AM
Friend of Wrox
 
Join Date: Oct 2005
Posts: 173
Thanks: 0
Thanked 2 Times in 1 Post
Default Textmode Password

Hi All

As part of a system I have developed I have a function the enables the user to update their username and password for the site. Basically it pulls their current username and password from the user DB into 2 text fields and then they can alter and update... simple!

The problem I have just encountered is that when you set the password field's textmode to PASSWORD it doesn't show the current password as '*******'. Is it possible to load the current password as I wanted to let the use alter either fields and not both every time.?

Warm Regards

Rit
__________________
Rit
www.designandonline.co.uk
INSPIRE | CREATE | DELIVER
 
Old March 13th, 2006, 04:29 PM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
Default

What does it show? And what do you mean by?
Quote:
quote:
Is it possible to load the current password as I wanted to let the use alter either fields and not both every time.?

 
Old March 13th, 2006, 04:37 PM
Friend of Wrox
 
Join Date: Oct 2005
Posts: 173
Thanks: 0
Thanked 2 Times in 1 Post
Default

Sorry Jim, I didn't make myself clear did I. Doh!

Basically what I was expecting the password field to do is load up with the users current password hidden behind asterisks so that if they could update the username field without having to retype the password.

At the moment with PASSWORD selected as the textmode for the password field, if they want to update just their username they have to retype their password too as the PASSWORD texmode stops their current password from loading up.
 
Old March 13th, 2006, 05:37 PM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
Default

If have never tried to load text into a password type textbox, but I am guessing is's proabaly by design for security purposes.

 
Old March 13th, 2006, 05:40 PM
Friend of Wrox
 
Join Date: Oct 2005
Posts: 173
Thanks: 0
Thanked 2 Times in 1 Post
Default

No worries, I suppose its there for a good reason.

Thanks anyway!

Rit
 
Old March 13th, 2006, 06:14 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Yeah, I agree. It's a security feature, and probably there for a good reason. However, it's also pretty easy to circumvent. Instead of assigning the password to the Text property, you can manually override the attribute "value", like this:

txtPassword.Attributes.Add("value", "The Old Password");

But, like you said: it's there for a good reason. With this trick, you'll be sending down a password in clear text where it can be cached. In fact, you actually shouldn't have the clear text password available on the server in the first place.

A common practice is to not update the password when the field is blank. This requires some explanation to the user, but it might be worth it.

HtH,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
 
Old March 14th, 2006, 05:11 PM
Friend of Wrox
 
Join Date: Oct 2005
Posts: 173
Thanks: 0
Thanked 2 Times in 1 Post
Default

Thanks Imar,

Rit
 
Old December 13th, 2006, 11:59 AM
Registered User
 
Join Date: Dec 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

This thread has been helpful to me.

What I ended up doing was
Code:
txtPassword.Attributes.Add("value", "~~~~");
so that four astericks would show up in the field.

Then when the user goes to save the account, it only updates the password if
Code:
txtPassword.Text != "~~~~"
This way, it is clear to the user that a password exists, the password is not sent to the page, and the password can be updated.

(the only flaw might be that no one can use the password "~~~~")






Similar Threads
Thread Thread Starter Forum Replies Last Post
using password in Acces Vince_421 Access VBA 8 February 6th, 2007 08:06 AM
password encryption angshujit ASP.NET 2.0 Basics 1 January 4th, 2007 03:34 PM
username and password abhi_loveu2002 ASP.NET 2.0 Basics 1 December 14th, 2006 05:25 AM
Need help password encrypt flyfish SQL Server 2000 9 July 12th, 2005 01:23 PM
Password rajuru PHP Databases 1 February 10th, 2005 12:05 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.