System.Web.Security.MembershipUser.ResetPassword Method

Resets a user's password to a new, automatically generated password.

Syntax

public virtual string ResetPassword ()

Returns

The new password for the membership user.

Remarks

MembershipUser.ResetPassword calls the MembershipProvider.ResetPassword(string, string) method of the membership provider referenced by the MembershipUser.ProviderName property to reset the password for the membership user to a new, automatically generated password. The new password is then returned to the caller.

If Membership.EnablePasswordReset is false, the membership provider will return an exception.

If Membership.RequiresQuestionAndAnswer is true, you must use the MembershipUser.ResetPassword(string) overload that takes a password answer as a parameter and supply the password answer for the membership user. If a password answer is required and an incorrect password answer is supplied, a System.Web.Security.MembershipPasswordException is thrown by the membership provider.

Requirements

Namespace: System.Web.Security
Assembly: System.Web (in System.Web.dll)
Assembly Versions: 2.0.0.0
Since: .NET 2.0