Export (0) Print
Expand All
Expand Minimize

ChangePassword.DisplayUserName Property

Gets or sets a value indicating whether the ChangePassword control should display the UserName control and label.

Namespace:  System.Web.UI.WebControls
Assembly:  System.Web (in System.Web.dll)

abstract DisplayUserName : bool with get, set 
override DisplayUserName : bool with get, set
<asp:ChangePassword DisplayUserName="True|False" />

Property Value

Type: System.Boolean
true if the ChangePassword control should display the UserName; otherwise, false. The default is false.

In order to change their password, users must be authenticated by the membership provider. To allow users who are not logged on to change their password, or to be authenticated by the membership provider with a different user account and then change the password for that account, the ChangePassword control can display a TextBox control to accept the user name.

You must set the DisplayUserName property to true if the ChangePassword control will be displayed to users who are not logged on; otherwise, the user will not be able to specify a user name.

The following code example shows how to set the DisplayUserName property to display the UserName control to users who are not logged on to the Web site.

No code example is currently available or this language may not be supported.

The following code example shows how to use an ASP.NET page that uses a ChangePassword control, and includes a handler for the ChangingPassword event named ChangingPassword. The code in the ChangingPassword handler compares the old password stored in the CurrentPassword property to the new password stored in NewPassword. If the two passwords are the same, changing the password fails.

The ChangePassword control sets the DisplayUserName property to true to enable the user to enter their user name. This means that the user does not have to log on to view the page.

The code example assumes that the ASP.NET Web site has been configured to use ASP.NET membership and Forms authentication, and that a user has been created whose name and password are known to you. For more information, see How to: Implement Simple Forms Authentication.

No code example is currently available or this language may not be supported.

.NET Framework

Supported in: 4.5.2, 4.5.1, 4.5, 4, 3.5, 3.0, 2.0

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Show:
© 2014 Microsoft