我的代码及错误如下:
================代码
Dim adspath As String = "LDAP://zhzx.gov/CN=hzh,OU=Users,DC=zhzx,DC=gov" Dim entry As New DirectoryEntry(adspath, "@zhzx.gov\hzh", "5518008", AuthenticationTypes.Secure)
Dim OldPassword As String = "5518008"
Dim NewPassword As String = "123456"
Dim tt As Object
tt = New Object() {OldPassword, NewPassword}
entry.Invoke("ChangePassword", tt)
==================错误
在服务器上没有这样一个对象。
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 异常详细信息: System.Runtime.InteropServices.COMException: 在服务器上没有这样一个对象。源错误:
行 58: Dim tt As Object
行 59: tt = New Object() {OldPassword, NewPassword}
行 60: entry.Invoke("ChangePassword", tt)
行 61: 'Catch err As Exception
行 62:
源文件: D:\test\test3.aspx.vb 行: 60 堆栈跟踪:
[COMException (0x80072030): 在服务器上没有这样一个对象。]
System.DirectoryServices.DirectoryEntry.Bind(Boolean throwIfFail) +514
System.DirectoryServices.DirectoryEntry.Bind() +10
System.DirectoryServices.DirectoryEntry.get_NativeObject() +10
System.DirectoryServices.DirectoryEntry.Invoke(String methodName, Object[] args) +71
test.test3.Page_Load(Object sender, EventArgs e) in D:\test\test3.aspx.vb:60
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Page.ProcessRequestMain() +731
================代码
Dim adspath As String = "LDAP://zhzx.gov/CN=hzh,OU=Users,DC=zhzx,DC=gov" Dim entry As New DirectoryEntry(adspath, "@zhzx.gov\hzh", "5518008", AuthenticationTypes.Secure)
Dim OldPassword As String = "5518008"
Dim NewPassword As String = "123456"
Dim tt As Object
tt = New Object() {OldPassword, NewPassword}
entry.Invoke("ChangePassword", tt)
==================错误
在服务器上没有这样一个对象。
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 异常详细信息: System.Runtime.InteropServices.COMException: 在服务器上没有这样一个对象。源错误:
行 58: Dim tt As Object
行 59: tt = New Object() {OldPassword, NewPassword}
行 60: entry.Invoke("ChangePassword", tt)
行 61: 'Catch err As Exception
行 62:
源文件: D:\test\test3.aspx.vb 行: 60 堆栈跟踪:
[COMException (0x80072030): 在服务器上没有这样一个对象。]
System.DirectoryServices.DirectoryEntry.Bind(Boolean throwIfFail) +514
System.DirectoryServices.DirectoryEntry.Bind() +10
System.DirectoryServices.DirectoryEntry.get_NativeObject() +10
System.DirectoryServices.DirectoryEntry.Invoke(String methodName, Object[] args) +71
test.test3.Page_Load(Object sender, EventArgs e) in D:\test\test3.aspx.vb:60
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Page.ProcessRequestMain() +731
entry.Invoke("ChangePassword", tt)tt是个Object实例,这个实例tt有ChangePassword这个方法吗?
Public Function Invoke( _
ByVal methodName As String, _
ByVal ParamArray args() As Object _
) As Object
object要怎样才能有ChangePassword方法啊,如果哪位有源码请给我帖一份
我不懂vb.net
帮你顶一下!!
帮你顶一下!!
{
你的代码
}我用c#的,你改成vb看看
你有源吗?能给我一份详细一点的吗?
userentry.Invoke("ChangePassword", new object[]{oldPsw, newPsw});
其中oldPsw为用户原先的密码,newPsw位用户的新密码;