Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

problem with TextMode

Status
Not open for further replies.

Sheffield

Programmer
Jun 1, 2001
180
US
Greetings,

PROBLEM: While retreiving UserID & Passwords from a *.mdb, I have been unable to make the TextBox display the asterisk '*' Rather, the TextBox appears empty if I use the TextMode="password" OR appears un-encrypted with the TextMode property omitted.

Worthy of note may be the fact that the Password column in the *.mdb has the Input Mask property set to 'password'. Nonetheless, the passwords are displayed on the web page un-encrypted (not good!).

Example:

Code:
<script runat=&quot;Server&quot;>
   ...Here I do the db stuff and assign the password value to txtPassword.Text.
</script>

<asp:TextBox id=&quot;txtPassword&quot;
TextMode=&quot;Password&quot;
Code:
 Runat=&quot;Server&quot; />

This will display an empty TextBox, where any NEW keystrokes are represented with asterisks (*), but I need to display a query result into the TextBox, with asterisks, so the user may change the password without it being viewed.

Anyway, I could use some guidance here:)
 
Shef: You could could assign the asterisks, perhaps, by first finding the lenght of the password (say 8), and then populating the txtbox as txtPassword.Text = &quot;abcdefgh&quot;, which should show the requisit number, i.e., just get the length of the password (since number of asterisks is pertinent) and then populate with a nonsense set of letters, to bring in the asterisks.

Of course, someone could inadvertently save &quot;abcdefgh&quot; instead of typing in a new password; but that would be a rare occurrence I think. Probably lots of work around here -- just an idea.
 
hmmm...thanks for your response. However, because I need to potentially update the db with the contents of the TextBox, it doesn't appear that would work.

In retrospect, I believe a better question would be this:
How is it possible for ASP.NET code to ignore the Microsoft Access Input Mask property on a particular column and display an unprotected password?

All the passwords in the db table are password protected with asterisks.

this has me absolutely dumbfounded...
 
Shef: I set up an example, and read from an &quot;.mdb&quot; having an input mask set to Password. It brought back the text, not the asterisks. Here's what I used:

TestAspNet.mdb
Table: tblPassword
Field1: Autonumber ID
Field2: Password (input mask, asterisks only)
Field3: Password (text of password)

When I ran the following page, and populated a textbox on the form, it came back as text, and not asterisks. Try this and see what results you get.

TestPassword.aspx
________________________________________________________

<%@ Page Language=&quot;VB&quot; Debug=&quot;false&quot; %>
<%@Import Namespace = &quot;Microsoft.VisualBasic&quot;%>
<%@Import Namespace = &quot;System&quot;%>
<%@Import Namespace = &quot;System.Web&quot;%>
<%@Import Namespace = &quot;System.Web.UI&quot;%>
<%@Import Namespace = &quot;System.Web.UI.WebControls&quot;%>
<%@Import Namespace = &quot;System.Web.UI.HtmlControls&quot;%>
<%@Import Namespace = &quot;System.Data&quot;%>
<%@Import Namespace = &quot;System.Data.OleDb&quot;%>
<script runat=&quot;server&quot;>
Private Sub Page_Load(sender As Object, e As EventArgs)
If Not IsPostBack Then
'open database...
Dim cmdSelect As OLEDbCommand
Dim dbconn As OleDbConnection = New OleDbConnection( _
&quot;Provider=Microsoft.Jet.OLEDB.4.0; &quot; & _
&quot;Data Source=&quot; & Server.MapPath(&quot;fpdb\TestASPNET.mdb;&quot;))
cmdSelect = New OLEDbCommand(&quot;SELECT Password FROM tblPassword WHERE ID=3&quot;, dbconn)
dbconn.Open()
Dim reader As OleDbDataReader
reader = cmdSelect.ExecuteReader()
While reader.Read()
txtPassword.Text = reader.GetValue(0)
End While
dbconn.Close()
End IF
End Sub
</script>

<HTML>
<HEAD>
<TITLE>TestPassword/.aspx</TITLE>
</HEAD>
<form id=&quot;Form1&quot; runat=&quot;server&quot;>
<br><asp:Textbox id=&quot;txtPassword&quot; runat=&quot;server&quot; />
</form>
</BODY>
</HTML>
 
Isadore,

Thanks for your reply. Your example makes perfect sense.

However, my goal is to return the asterisks and populate the TextBox with them and not the actual text of the password.

Again, I don't want to display the actual text of the password, but rather the asterisks of the input mask in the *.mdb.

Again, I greatly appreciate any additional input:)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top