Reputation:
I would like to call the aspnet Membership ResetPassword stored procedure called: aspnet_Membership_ResetPassword
within the aspnetdb
database.
When I look at the SqlMembershipProvider
class there is a ResetPassword method but this is not useful as I cannot pass the parameter PasswordFormat as I can with the stored procedure.
Can anyone advise how I can call this stored procedure explictly from the codebehind of an aspx page in c#?
Upvotes: 1
Views: 2878
Reputation: 2493
If you are using Encryption mode to store the password it will be better to use ChangePassword Method like the following:
_MembershipUser.ChangePassword(_MembershipUser.GetPassword(),"NewP@ssw0rd");
Upvotes: 2
Reputation: 4734
The PasswordFormat is a flag that represents whether the ASP is storing the password in the database as either hashed, encrypted, or plain text. This is typically specified only once (in the web.config).
passwordFormat="Hashed"
It can be found in the Membership sub-section of the Configuration section of the web.config as seen below...
<membership>
<providers>
<clear/>
<add name="AspNetSqlMembershipProvider"
type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
connectionStringName="LocalSqlServer"
enablePasswordRetrieval="false"
enablePasswordReset="true"
requiresQuestionAndAnswer="false"
requiresUniqueEmail="true"
passwordFormat="Hashed"
maxInvalidPasswordAttempts="5"
minRequiredPasswordLength="6"
minRequiredNonalphanumericCharacters="0"
passwordAttemptWindow="10"
passwordStrengthRegularExpression=""
applicationName="/"
/>
</providers>
</membership>
As stated earlier, just use the ChangePassword method, and the PasswordFormat setting will be pulled from the web.config automatically.
Upvotes: 0