System.NotSupportedException:指定的方法不支持 [英] System.NotSupportedException: Specified method is not supported
问题描述
是否有可能获取用户的密码?怎么样,好吗?当我已经试过这code:
Is it possible to get the password of a user? How, please? When I've tried this code :
WebSecurity.InitializeDatabaseConnection("nectarys-pc.MonitoringN.dbo", "Superviseur", "UserId", "matricule", autoCreateTables: true);
var membership = (SimpleMembershipProvider)Membership.Provider;
model.motDePasse = membership.GetUser(superviseur.matricule, false).GetPassword();
这个例外出现在最后一行:
This exception appears in the last line :
System.NotSupportedException:指定的方法不支持
System.NotSupportedException: Specified method is not supported.
如何应对呢?
注意是 superviseur.matricule
不是问题的根源。
推荐答案
根据MSDN -
<一href=\"http://msdn.microsoft.com/en-us/library/system.web.security.membershipprovider.getpassword.aspx\"相对=nofollow>如果EnablePasswordRetrieval在web.config中是假的,一个NotSupportedException异常被抛出。
As per MSDN - If EnablePasswordRetrieval in web.config is false, a NotSupportedException exception is thrown.
勾选此资源,找出如何在Web.config中 enablePasswordReset设置
Check this resource to find out how to set enablePasswordReset in Web.config
这篇关于System.NotSupportedException:指定的方法不支持的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!