【问题标题】:System.Runtime.InteropServices.COMException: The specified network password is not correct. (Exception from HRESULT: 0x80070056)System.Runtime.InteropServices.COMException:指定的网络密码不正确。 (来自 HRESULT 的异常:0x80070056)
【发布时间】:2012-02-08 23:04:57
【问题描述】:

每隔一段时间,当我尝试更改用户密码时,我都会收到以下错误......不是每次,甚至每 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% 的时间都会发生(如果密码真的错误的话)

谢谢,

卡尔-

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.

【问题讨论】:

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


    【解决方案1】:

    作为第一步,只需将临时日志添加到 accesscontrol/changepassword_aspx 用于输入的用户名/密码。 将这些与 ELMAH 向您展示的内容联系起来。

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

    这里有一个有趣的注释: http://forums.asp.net/t/1299086.aspx/1

    如果您使用的是集成的,那么您如何提供 ChangePassword 调用的 CurrentPwd? (密码是 永远不会以明文形式提供) 如果用户已经通过身份验证,那么您没有 使用更改密码。相反,您可以使用 SetPassword 无论旧密码如何,都强制使用新密码: user.Invoke("SetPassword", new object[] {newPwd});

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

    【讨论】:

    • 忘了说,我验证了用户名和旧通行证,使用会员资格提供程序,就在这被调用之前......这使它更加混乱(将此添加到帖子中)
    • 我不确定是否允许添加日志语句来输出用户密码...在大多数情况下绝对不应该。
    • 使用wireshark然后记录流量,你至少会看到用户名,希望能帮助缩小范围并可能扩展数据包信息
    • @KyleW 请注意我上面关于临时日志记录的措辞。我通常不支持 EVER 记录密码,但由于这里的问题与网络密码相关,并且由于说 Kerberos,您无法嗅探此问题,因此选项受到了一些限制。
    【解决方案2】:

    尝试在产生错误的机器上查看事件查看器,特别是安全日志。您可能会在那里发现一个错误,指出尝试了错误密码的帐户。

    【讨论】:

      猜你喜欢
      • 2011-12-11
      • 2010-10-01
      • 2015-05-04
      • 2015-11-08
      • 1970-01-01
      • 2016-05-03
      • 2013-06-15
      • 2012-01-07
      • 2010-10-28
      相关资源
      最近更新 更多