problems populating htmlinputtext control when type is set to "password"

Discussion in 'ASP .Net' started by Chris Barrow, Nov 12, 2003.

  1. Chris Barrow

    Chris Barrow Guest

    Hi everyone,

    Does anyone know if there is a problem populating a
    system.web.ui.htmlcontrols.htmlinputtext control when the
    control's type is set to "password?" I am attempting to
    retreive a member's record from a database and populate
    the control with the member's password. Unfortunately, if
    the control declared on the .aspx side is as follows:

    <input type="password" id="txtPassword" runat="server"/>

    the control appears to be populated with the value, but
    appears blank when the control is displayed in the
    browser. The code in .vb code-behind is quite simple:

    Protected WithEvents txtPassword as
    System.Web.UI.HtmlControls.HtmlInputText

    Private Sub Page_Load()
    'Get value from db...
    'Assign to control
    txtPassword.Value = strPassword
    End Sub

    If I change the control's "type" attribute to "text", the
    value is displayed correctly within the control. If anyone
    has some insight into the matter, I would greatly
    appreciate it.

    Thanks,

    Chris Barrow
    Chris Barrow, Nov 12, 2003
    #1
    1. Advertising

  2. Chris,

    This is by design.

    If a password text box's text were set in code the password would be visible
    in the view source. Obviously not secure.

    Sincerely,

    --
    S. Justin Gengo, MCP
    Web Developer

    Free code library at:
    www.aboutfortunate.com

    "Out of chaos comes order."
    Nietzche


    "Chris Barrow" <> wrote in message
    news:022901c3a95f$c08b5590$...
    > Hi everyone,
    >
    > Does anyone know if there is a problem populating a
    > system.web.ui.htmlcontrols.htmlinputtext control when the
    > control's type is set to "password?" I am attempting to
    > retreive a member's record from a database and populate
    > the control with the member's password. Unfortunately, if
    > the control declared on the .aspx side is as follows:
    >
    > <input type="password" id="txtPassword" runat="server"/>
    >
    > the control appears to be populated with the value, but
    > appears blank when the control is displayed in the
    > browser. The code in .vb code-behind is quite simple:
    >
    > Protected WithEvents txtPassword as
    > System.Web.UI.HtmlControls.HtmlInputText
    >
    > Private Sub Page_Load()
    > 'Get value from db...
    > 'Assign to control
    > txtPassword.Value = strPassword
    > End Sub
    >
    > If I change the control's "type" attribute to "text", the
    > value is displayed correctly within the control. If anyone
    > has some insight into the matter, I would greatly
    > appreciate it.
    >
    > Thanks,
    >
    > Chris Barrow
    S. Justin Gengo, Nov 12, 2003
    #2
    1. Advertising

  3. Chris Barrow

    Chris Barrow Guest

    S.,

    You're right of course. I don't know what frame of mind I
    was in when I was working through the problem. Thanks for
    your response.

    Chris...
    >-----Original Message-----
    >Chris,
    >
    >This is by design.
    >
    >If a password text box's text were set in code the

    password would be visible
    >in the view source. Obviously not secure.
    >
    >Sincerely,
    >
    >--
    >S. Justin Gengo, MCP
    >Web Developer
    >
    >Free code library at:
    >www.aboutfortunate.com
    >
    >"Out of chaos comes order."
    > Nietzche
    >
    >
    >"Chris Barrow" <>

    wrote in message
    >news:022901c3a95f$c08b5590$...
    >> Hi everyone,
    >>
    >> Does anyone know if there is a problem populating a
    >> system.web.ui.htmlcontrols.htmlinputtext control when

    the
    >> control's type is set to "password?" I am attempting to
    >> retreive a member's record from a database and populate
    >> the control with the member's password. Unfortunately,

    if
    >> the control declared on the .aspx side is as follows:
    >>
    >> <input type="password" id="txtPassword" runat="server"/>
    >>
    >> the control appears to be populated with the value, but
    >> appears blank when the control is displayed in the
    >> browser. The code in .vb code-behind is quite simple:
    >>
    >> Protected WithEvents txtPassword as
    >> System.Web.UI.HtmlControls.HtmlInputText
    >>
    >> Private Sub Page_Load()
    >> 'Get value from db...
    >> 'Assign to control
    >> txtPassword.Value = strPassword
    >> End Sub
    >>
    >> If I change the control's "type" attribute to "text",

    the
    >> value is displayed correctly within the control. If

    anyone
    >> has some insight into the matter, I would greatly
    >> appreciate it.
    >>
    >> Thanks,
    >>
    >> Chris Barrow

    >
    >
    >.
    >
    Chris Barrow, Nov 13, 2003
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Wolfgang Schmidt
    Replies:
    2
    Views:
    490
    Wolfgang Schmidt
    Mar 2, 2004
  2. Ma³y Piotruœ

    ASP.NET: HtmlInputText = Nothing

    Ma³y Piotruœ, Dec 4, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    433
    Ken Cox - Microsoft MVP
    Dec 4, 2005
  3. Jim in Arizona
    Replies:
    0
    Views:
    392
    Jim in Arizona
    Sep 12, 2006
  4. George Ter-Saakov

    creating my own HtmlInputText

    George Ter-Saakov, Jun 29, 2007, in forum: ASP .Net
    Replies:
    0
    Views:
    347
    George Ter-Saakov
    Jun 29, 2007
  5. AAaron123
    Replies:
    2
    Views:
    2,141
    AAaron123
    Jan 16, 2009
Loading...

Share This Page