asp.net membership 密码重设
时间:2020-10-21 10:57:45|栏目:.NET代码|点击: 次
在web.config中:
<connectionStrings>
<add name="SqlServices" connectionString="server=.;database=data;uid=sa;pwd=123;" />
</connectionStrings>
<membership defaultProvider="SqlProvider" userIsOnlineTimeWindow="15">
<providers>
<clear/>
<add name="SqlProvider"
type="System.Web.Security.SqlMembershipProvider"
connectionStringName="SqlServices"
applicationName="dev"
enablePasswordRetrieval="false"
enablePasswordReset="true"
requiresQuestionAndAnswer="false"
requiresUniqueEmail="false"
passwordFormat="Hashed"
minRequiredPasswordLength="1"
minRequiredNonalphanumericCharacters="0"
/>
</providers>
</membership>
重设密码关键语句:
MembershipUser mem = Membership.GetUser(this.lblUserName.Text);
string p = mem.ResetPassword();
mem.ChangePassword(p, "123456");
复制代码 代码如下:
<connectionStrings>
<add name="SqlServices" connectionString="server=.;database=data;uid=sa;pwd=123;" />
</connectionStrings>
复制代码 代码如下:
<membership defaultProvider="SqlProvider" userIsOnlineTimeWindow="15">
<providers>
<clear/>
<add name="SqlProvider"
type="System.Web.Security.SqlMembershipProvider"
connectionStringName="SqlServices"
applicationName="dev"
enablePasswordRetrieval="false"
enablePasswordReset="true"
requiresQuestionAndAnswer="false"
requiresUniqueEmail="false"
passwordFormat="Hashed"
minRequiredPasswordLength="1"
minRequiredNonalphanumericCharacters="0"
/>
</providers>
</membership>
重设密码关键语句:
复制代码 代码如下:
MembershipUser mem = Membership.GetUser(this.lblUserName.Text);
string p = mem.ResetPassword();
mem.ChangePassword(p, "123456");
上一篇:asp.net实现非常实用的自定义页面基类(附源码)
栏 目:.NET代码
下一篇:C#保存与读取DataTable信息到XML格式的方法
本文地址:http://www.codeinn.net/misctech/14208.html