473,387 Members | 1,641 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Setting the value of a password textbox at runtime

Hi all, I thought that this would be very basic. Basically, I have a textbox
set at type password. When I try to set the value of this textbox at runtime
the text field does not get populated.

I thought I could just go
=========
txtPassword.Text = "MyPassword"
=========

If I do this, nothing appears in the textbox at all.

Any help appreciated, thanks in advance
Mark
Nov 18 '05 #1
2 1664
Jos
"John" <JD@noSpam.com> wrote in message news:c5**********@lust.ihug.co.nz...
Hi all, I thought that this would be very basic. Basically, I have a textbox set at type password. When I try to set the value of this textbox at runtime the text field does not get populated.

I thought I could just go
=========
txtPassword.Text = "MyPassword"
=========

If I do this, nothing appears in the textbox at all.

Any help appreciated, thanks in advance
Mark


This is normal behavior.

If a password would be set before the page is sent to the user,
anyone looking at the HTML source of the page would be able to
read the password.

--

Jos
Nov 18 '05 #2
Sending the password in plain text to the browser is a bad idea from a
security standpoint so the default security settings discourage it.
(Anybody can do a view source for the page
and see the password)

However there is a workaround if you're determined. You can set the
password text via client side script.
Here's the simplest example I've seen:

MyPWTextBox.Attributes.Add("value", strPassword)

This server side code outputs the needed client side code

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
Hire top-notch developers at http://www.able-consulting.com
"John" <JD@noSpam.com> wrote in message news:c5**********@lust.ihug.co.nz...
Hi all, I thought that this would be very basic. Basically, I have a textbox set at type password. When I try to set the value of this textbox at runtime the text field does not get populated.

I thought I could just go
=========
txtPassword.Text = "MyPassword"
=========

If I do this, nothing appears in the textbox at all.

Any help appreciated, thanks in advance
Mark

Nov 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Mark | last post by:
All, Excuse the re-post but I have found something which works for the UserID but not for the Password (see previous post below). The problem is I don't understand how it works and therefore...
4
by: Ian Walsh | last post by:
I have a user details form with a textbox for a password on it (textmode=password). I want to be able to set the text in the textbox when retrieving user details. I will be filling the box with a...
2
by: John | last post by:
Hi all, I thought that this would be very basic. Basically, I have a textbox set at type password. When I try to set the value of this textbox at runtime the text field does not get populated. I...
4
by: David Kyle | last post by:
Hello there, I'm having some problems setting the TextBox.Text Property in my code and having it returned to the client in the source when the TextBox.TextMode="Password". I know this is...
2
by: corey s. | last post by:
My system allows a user to change their email address and password. When the user goes to the "Update Profile" page the email address can be populated but the Password/ConfirmPassword fields can...
6
by: Andre Ranieri | last post by:
I'm trying to create a login page for customers to log into our corporate website, our presidents naturally wants the user and password fields to populate from a cookie so the customer doesn't have...
0
by: Luqman | last post by:
I have created a datasource and binding its fields to textbox using Binding Navigator in VB.Net 2005, my database is Oracle 9i, how can I pass the user name and password to the App.config to open...
1
by: laredotornado | last post by:
Hi, I'm using PHP 4.4.4 on Apache 2 on Fedora Core 5. PHP was installed using Apache's apxs and the php library was installed to /usr/local/php. However, when I set my "error_reporting"...
4
by: Jeff | last post by:
hi asp.net 2.0 I have created a custom web control, here is it's header: <%@ Control Language="C#" AutoEventWireup="true" CodeFile="EditUserBox.ascx.cs" Inherits="Controls_EditUserBox" %> ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.