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

发布于 2025-01-03 15:21:56 字数 3526 浏览 4 评论 0原文

当我尝试更改用户密码时,每隔一段时间就会收到以下错误......不是每次,甚至每 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 密码? 用户的旧密码? 新的?

还有别的事吗?

有谁知道如何找出它不满意的密码,或者坦白地说,关于此异常的任何提示?

在我看来,这与身份验证或会话过期有关,否则 100% 的情况都会发生这种情况(如果密码确实错误)

谢谢,

Cal-

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.

I'm getting the error below, every once in a while, when I try to change the users password....not everytime, or even every 10 times.... it's only happening so far in our live produciton environment.

the source is pretty straight forward, it's even in the stack trace

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

Right before that I validate the username and the old password..

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

So that should be correct, and the conneciton to ad should be correct, but then why is the NEW password wrong?

What I can't figure out is WHICH password does it thinks is wrong part of the time.

The password to AD on the membership provider in the web.config?
the users old passowrd?
The new one?

Something else?

Does anyone know how to figure out which passowrd it's not happy with, or frankly any hints on this exception whatsoever?

It seems to me that's it's got to have something to do with an authentication or a session expiring, or it would be happeneiing 100% of the time (if the password were really wrong)

Thanks,

Cal-

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

左耳近心 2025-01-10 15:21:56

第一步,只需将临时日志记录添加到
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});

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

As a first step, simply add temporary logging to
accesscontrol/changepassword_aspx for the entered username/password.
Associate those with what ELMAH is showing you.

This is likely the user's password (old one) that is failing, not anything from the web.config.

There is an interesting note here though:
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});

That may be one solution for you.

平生欢 2025-01-10 15:21:56

尝试在生成错误的计算机上的事件查看器中查找,特别是安全日志。您可能会发现一个错误,其中提到尝试使用错误密码的帐户。

Try looking in event viewer on the machine generating the error, specifically the security logs. You may find an error there that mentions which account the incorrect password was attempted for.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文