Redigera

Dela via


ActiveDirectoryMembershipProvider.RequiresQuestionAndAnswer Property

Definition

Gets a value indicating whether the membership provider is configured to require a password question and answer when creating a user.

public:
 virtual property bool RequiresQuestionAndAnswer { bool get(); };
public override bool RequiresQuestionAndAnswer { get; }
member this.RequiresQuestionAndAnswer : bool
Public Overrides ReadOnly Property RequiresQuestionAndAnswer As Boolean

Property Value

true if the ActiveDirectoryMembershipProvider object is configured to require a password question and answer for a user; otherwise, false. The default is false.

Exceptions

An attempt to access the RequiresQuestionAndAnswer property was made before the ActiveDirectoryMembershipProvider instance was initialized.

Remarks

The RequiresQuestionAndAnswer property is set in your application's configuration file using the requiresQuestionAndAnswer attribute of the membership Element (ASP.NET Settings Schema) element. If the property is not set in the application's configuration file, the RequiresQuestionAndAnswer property is set to the default value of false.

When the requiresQuestionAndAnswer attribute is set to true, you must also map attributeMapPasswordQuestion and attributeMapPasswordAnswer to attributes in the Active Directory schema. Otherwise, a ProviderException is thrown at initialization.

Note

You can require a password question and answer when creating a user, but set the EnablePasswordReset property to false to prevent users from changing their passwords using the ActiveDirectoryMembershipProvider class.

Important

When you place user credentials in your Web.config file, there are potential security threats. Users with access rights to the directory containing the Web.config file can read the file, and thus see the credentials. For details on how to protect against this threat, see Encrypting Configuration Information Using Protected Configuration.

Applies to

See also