Compartilhar via


PasswordTextBox Class

Represents an input form control for passwords.

Inheritance Hierarchy

System.Object
  System.Web.UI.Control
    System.Web.UI.WebControls.WebControl
      Microsoft.SharePoint.WebControls.PasswordTextBox

Namespace:  Microsoft.SharePoint.WebControls
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: No

Syntax

'Declaration
<ValidationPropertyAttribute("Password")> _
<AspNetHostingPermissionAttribute(SecurityAction.LinkDemand, Level := AspNetHostingPermissionLevel.Minimal)> _
<AspNetHostingPermissionAttribute(SecurityAction.InheritanceDemand, Level := AspNetHostingPermissionLevel.Minimal)> _
Public Class PasswordTextBox _
    Inherits WebControl _
    Implements IPostBackDataHandler
'Usage
Dim instance As PasswordTextBox
[ValidationPropertyAttribute("Password")]
[AspNetHostingPermissionAttribute(SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
[AspNetHostingPermissionAttribute(SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
public class PasswordTextBox : WebControl, 
    IPostBackDataHandler

Remarks

This control can be used in one of two modes:

  1. Entering a password for the first time

  2. Editing a previously stored password

In the first case, the control will display an empty password field. The user can supply a value or leave the field empty. In either case, the first postback will raise the PasswordChanged event.

In the second case, the user will be "editing" a previously saved password. In this mode, the control will display eight asterisks to show the user that a previously saved value exists. If the user does not change this value then the PasswordChanged event will not be raised and the PasswordWasChanged property will be false.

There are two postback and redraw scenarios. The first is when the user was in the "edit a previously saved password" mode and they did not alter the password value. In this case, the eight asterisks were uploaded as the user's input. The control will render another eight asterisks on the redraw.

The second redraw scenario is when the user supplied a password to this form. It may have been specified just now on this postback or it may have been specified on a previous postback. In either case, the control will still draw asterisks in the input control. The user-supplied password is never displayed. In this case, the number of fake asterisks that is used is the same number as the number of characters in the user-supplied password.

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference

PasswordTextBox Members

Microsoft.SharePoint.WebControls Namespace