System.Runtime.InteropServices.COMException:指定的网络密码不正确。 (HRESULT异常:0x80070056)

时间:2012-02-08 23:04:58

标签: c# asp.net active-directory asp.net-membership membership-provider

我每隔一段时间就会收到以下错误,当我尝试更改用户密码时....不是每次都是,甚至每10次....这只是我们的现场制作中发生的事情环境。

源非常简单,它甚至在堆栈跟踪中

ActiveDirectoryMembershipProvider.ChangePassword(String username, String oldPassword, String newPassword)

在此之前我验证用户名和旧密码..

if ( !Membership.ValidateUser ( cpCv.LoginName, cpCv.OldPassword ) )
                {
                    sMsg = "Failed to validate, old password is probably incorrect.";
                    return sMsg;
                }

所以这应该是正确的,广告的连接应该是正确的,但是为什么新密码错了?

我无法弄清楚的是,它认为密码是错误的部分时间。

web.config中成员资格提供程序上的AD密码? 用户旧的passowrd? 新的?

还有别的吗?

有谁知道如何弄清楚哪个不满意,或者坦率地对这个例外的任何暗示?

在我看来,它必须与身份验证或会话过期有关,或者它会在100%的时间内发生(如果密码确实是错误的)

谢谢,

卡尔 -

System.Runtime.InteropServices.COMException: The specified network password is not correct. (Exception from HRESULT: 0x80070056)
Generated: Wed, 08 Feb 2012 22:54:18 GMT

System.Web.HttpException (0x80004005): Exception of type 'System.Web.HttpException' was thrown. ---> System.Web.HttpUnhandledException (0x80004005): Exception of type 'System.Web.HttpUnhandledException' was thrown. ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Runtime.InteropServices.COMException: The specified network password is not correct. (Exception from HRESULT: 0x80070056)
   --- End of inner exception stack trace ---
   at System.DirectoryServices.DirectoryEntry.Invoke(String methodName, Object[] args)
   at System.Web.Security.ActiveDirectoryMembershipProvider.ChangePassword(String username, String oldPassword, String newPassword)
   at Jcdc.AccessControl.ChangePassword.DoChangePassword(String sMsg) in d:\CC\StudentPortal3G\Source\StudentPortal3G\AccessControl\ChangePassword.aspx.cs:line 129
   at Jcdc.AccessControl.ChangePassword.Button1_Click(Object sender, EventArgs e) in d:\CC\StudentPortal3G\Source\StudentPortal3G\AccessControl\ChangePassword.aspx.cs:line 50
   at System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument)
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
   at System.Web.UI.Page.HandleError(Exception e)
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
   at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
   at System.Web.UI.Page.ProcessRequest()
   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
   at System.Web.Util.AspCompatApplicationStep.EndAspCompatExecution(IAsyncResult ar)
   at ASP.accesscontrol_changepassword_aspx.EndProcessRequest(IAsyncResult ar) in c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\44dfbb4a\ab9ba47b\App_Web_aky3zvas.1.cs:line 0
   at System.Web.HttpApplication.CallHandlerExecutionStep.OnAsyncHandlerCompletion(IAsyncResult ar)

Server Variables 
Name    Value
Page    https://live.jobcorps.org/AccessControl/ChangePassword.aspx

Time    2/8/2012 4:54:18 PM Central Standard Time
IP Address  10.111.50.131
MachineName     JCDC-S-SAW-001
JCDC User   Jackson.David
--------------------    ---------------------------------------------------------------------------------
Powered by ELMAH, version 1.0.10617.936 (debug; BETA3; net-3.5). Copyright (c) 2007, Atif Aziz. All rights reserved.

2 个答案:

答案 0 :(得分:1)

尝试在生成错误的计算机上查看事件查看器,特别是安全日志。您可能会在那里找到一个错误,提到哪个帐户尝试了错误的密码。

答案 1 :(得分:1)

首先,只需添加临时日志记录即可 accesscontrol / changepassword_aspx用于输入的用户名/密码。 将这些与ELMAH向您展示的内容联系起来。

这可能是用户的密码(旧密码)失败,而不是web.config中的任何密码。

虽然有一个有趣的说明: http://forums.asp.net/t/1299086.aspx/1


If you are using integrated, then how are you able to provide 
the CurrentPwd for the ChangePassword call? (The password is
 never available in cleartext)

If the user is already authenticated, then you don't have
 to use ChangePassword. Instead, you can use SetPassword 
to force the new password regardless of the old password: 
user.Invoke("SetPassword", new object[] {newPwd});

这可能是您的一个解决方案。