在ASP.NET中更改用户密码表单验证 [英] Change User Password in ASP.NET Forms Authentication
问题描述
我code在C#(ASP.NET)和正在使用Forms身份验证。
我想知道这是不使用ASP来更改用户密码的最佳方法:ChangePassword控件
我不想使用重置密码的方法。
我只是想抓住密码我有我的文本框里面和我年长的密码更换。
请注意,我用了passwordFormat是了passwordFormat =散列
有些code段将是有益的
编辑:
I code in C# (ASP.NET) and am using Forms authentication.
I would like to know which is the best method to change a user password without using the asp:ChangePassword control.
I dont want to use the reset password method.
I just want to grab the password i have inside my textbox and replace it with my older password.
Please note that the PasswordFormat I use is passwordFormat="Hashed"
Some code snippets would be helpful
在我的web.config,我已经设置enablePasswordRetrieval =false的
我用下面的方法
In my web.config, I have set enablePasswordRetrieval="false"
I used the following method
var myUser = Membership.GetUser(userID);
bool isChangeSuccess = myUser.ChangePassword(
myUser.GetPassword(),
ActivateUserPasswordText.Text.Trim());
这给我的错误,结果
It gives me the error,
此会员供应商一直没有
配置为支持密码
检索。
This Membership Provider has not been configured to support password retrieval.
可以做些什么来解决这些问题?
我真的很喜欢我了passwordFormat是哈希本身。
What could be done to solve these issues? I would really like my PasswordFormat to be hash itself.
问候,
纳文何塞
Regards,
Naveen Jose
推荐答案
明白了解决。感谢我的同胞开发商。
Got it solved. Thanks to my fellow developer.
var myUser = Membership.GetUser(userID);
bool isChangeSuccess = myUser.ChangePassword(
myUser.ResetPassword(),
ActivateUserPasswordText.Text.Trim());
不能说我喜欢它虽然很多。
我以为ResetPassword()将返回一个布尔值。
Cant say I liked it much though.
I thought ResetPassword() would be returning a bool.
这篇关于在ASP.NET中更改用户密码表单验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!