Re: change password in active directory by webapplication (vb.net)
From: Sara rafiee (sara_ir110_at_yahoo.com)
Date: 04/26/04
- Next message: Paul Glavich [MVP - ASP.NET]: "Re: Timing (forms) authenticated sessions out."
- Previous message: Paul Glavich [MVP - ASP.NET]: "Re: Sessions & SSL"
- In reply to: Joe Kaplan \(MVP - ADSI\): "Re: change password in active directory by webapplication (vb.net)"
- Next in thread: Joe Kaplan \(MVP - ADSI\): "Re: change password in active directory by webapplication (vb.net)"
- Reply: Joe Kaplan \(MVP - ADSI\): "Re: change password in active directory by webapplication (vb.net)"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Date: Mon, 26 Apr 2004 02:51:43 -0700
Hi
this is my error on my code for changing user password in active
directory programmatically
Inherits System.Web.UI.Page
Protected WithEvents newpass As System.Web.UI.WebControls.TextBox
Protected WithEvents btn1 As System.Web.UI.WebControls.Button
Protected WithEvents username As System.Web.UI.WebControls.TextBox
Protected WithEvents txt2 As System.Web.UI.WebControls.TextBox
Protected WithEvents txt1 As System.Web.UI.WebControls.TextBox
Protected WithEvents btn2 As System.Web.UI.WebControls.Button
Protected WithEvents oldpass As System.Web.UI.WebControls.TextBox
Private Sub btn1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btn1.Click
Dim dom As DirectoryEntry = New
DirectoryEntry("LDAP://Hosnieh_Rafiee", "Hosnieh_Rafiee\admin11", "bbb")
Dim entry As DirectoryEntry = New
DirectoryEntry("LDAP://Hosnieh_Rafiee", username.Text, oldpass.Text)
Dim search As New DirectorySearcher(entry)
Dim result As SearchResult = search.FindOne
'If entry.Password = oldpass.Text Then
Dim b As String
entry.Invoke("setPassword", "newpassword")
entry.CommitChanges()
Response.Write(entry.Password)
Response.Write("successful")
'Else
' Response.Write("your username or password is incorrect")
'End If
End Sub
Server Error in '/netaccount' Application.
------------------------------------------------------------
The Active Directory property cannot be found in the cache.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.
Exception Details: System.Runtime.InteropServices.COMException: The
Active Directory property cannot be found in the cache.
Source Error:
Line 42: Dim b As String
Line 43:
Line 44: entry.Invoke("setPassword", "newpassword")
Line 45: entry.CommitChanges()
Line 46:
Source File: g:\My Documents\Visual Studio
Projects\netaccount\WebForm1.aspx.vb Line: 44
Stack Trace:
[COMException (0x80020006): The Active Directory property cannot be
found in the cache.
]
System.RuntimeType.InvokeDispMethod(String name, BindingFlags
invokeAttr, Object target, Object[] args, Boolean[] byrefModifiers,
Int32 culture, String[] namedParameters) +0
System.RuntimeType.InvokeMember(String name, BindingFlags invokeAttr,
Binder binder, Object target, Object[] args, ParameterModifier[]
modifiers, CultureInfo culture, String[] namedParameters) +473
System.Type.InvokeMember(String name, BindingFlags invokeAttr, Binder
binder, Object target, Object[] args) +29
System.DirectoryServices.DirectoryEntry.Invoke(String methodName,
Object[] args)
netaccount.WebForm1.btn1_Click(Object sender, EventArgs e) in g:\My
Documents\Visual Studio Projects\netaccount\WebForm1.aspx.vb:44
System.Web.UI.WebControls.Button.OnClick(EventArgs e)
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.Rai
sePostBackEvent(String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler
sourceControl, String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
System.Web.UI.Page.ProcessRequestMain()
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
- Next message: Paul Glavich [MVP - ASP.NET]: "Re: Timing (forms) authenticated sessions out."
- Previous message: Paul Glavich [MVP - ASP.NET]: "Re: Sessions & SSL"
- In reply to: Joe Kaplan \(MVP - ADSI\): "Re: change password in active directory by webapplication (vb.net)"
- Next in thread: Joe Kaplan \(MVP - ADSI\): "Re: change password in active directory by webapplication (vb.net)"
- Reply: Joe Kaplan \(MVP - ADSI\): "Re: change password in active directory by webapplication (vb.net)"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]