Private Shared Sub SetPassword(ByVal dEntry As DirectoryEntry, ByVal sPassword As String)
Const ADS_OPTION_PASSWORD_PORTNUMBER As Long = 6
Const ADS_OPTION_PASSWORD_METHOD As Long = 7
Dim intPort As Integer
Const ADS_PASSWORD_ENCODE_CLEAR As Integer = 1
intPort = Int32.Parse("389")
dEntry.Invoke("SetOption", New Object() {ADS_OPTION_PASSWORD_PORTNUMBER, intPort})
dEntry.Invoke("SetOption", New Object() {ADS_OPTION_PASSWORD_METHOD, ADS_PASSWORD_ENCODE_CLEAR})
dEntry.Invoke("SetPassword", New Object() {"Password1234"}) ===> Error
End Sub
Error
Exception has been thrown by the target of an invocation.
System.Reflection.TargetInvocationException was unhandled by user code
Message="Exception has been thrown by the target of an invocation."
Source="System.DirectoryServices"
StackTrace:
at System.DirectoryServices.DirectoryEntry.Invoke(String methodName, Object[] args) at BookIP.SetPassword(DirectoryEntry dEntry, String sPassword) in c:\inetpub\wwwroot\IP Guest\BookIP.aspx.vb:line 404 at BookIP.CreateNewUser(String Name, String
Lname, String UserLogon, String group) in c:\inetpub\wwwroot\IP Guest\BookIP.aspx.vb:line 330 at BookIP.Page_Load(Object sender, EventArgs e) in c:\inetpub\wwwroot\IP Guest\BookIP.aspx.vb:line 69 at System.Web.UI.Control.OnLoad(EventArgs e) at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
InnerException: System.DirectoryServices.DirectoryServicesCOMException
ErrorCode=-2147016651
ExtendedError=31
ExtendedErrorMessage="0000001F: SvcErr: DSID-031A0FC0, problem 5003 (WILL_NOT_PERFORM), data 0 "
Message="The server is unwilling to process the request. (Exception from HRESULT: 0x80072035)"
InnerException:
niwe034
0 Points
1 Post
Con't setpassword
Nov 29, 2010 09:01 AM|LINK
Private Shared Sub SetPassword(ByVal dEntry As DirectoryEntry, ByVal sPassword As String)
Const ADS_OPTION_PASSWORD_PORTNUMBER As Long = 6
Const ADS_OPTION_PASSWORD_METHOD As Long = 7
Dim intPort As Integer
Const ADS_PASSWORD_ENCODE_CLEAR As Integer = 1
intPort = Int32.Parse("389")
dEntry.Invoke("SetOption", New Object() {ADS_OPTION_PASSWORD_PORTNUMBER, intPort})
dEntry.Invoke("SetOption", New Object() {ADS_OPTION_PASSWORD_METHOD, ADS_PASSWORD_ENCODE_CLEAR})
dEntry.Invoke("SetPassword", New Object() {"Password1234"}) ===> Error
End Sub
Error
Exception has been thrown by the target of an invocation.
System.Reflection.TargetInvocationException was unhandled by user code
Message="Exception has been thrown by the target of an invocation."
Source="System.DirectoryServices"
StackTrace:
at System.DirectoryServices.DirectoryEntry.Invoke(String methodName, Object[] args) at BookIP.SetPassword(DirectoryEntry dEntry, String sPassword) in c:\inetpub\wwwroot\IP Guest\BookIP.aspx.vb:line 404 at BookIP.CreateNewUser(String Name, String Lname, String UserLogon, String group) in c:\inetpub\wwwroot\IP Guest\BookIP.aspx.vb:line 330 at BookIP.Page_Load(Object sender, EventArgs e) in c:\inetpub\wwwroot\IP Guest\BookIP.aspx.vb:line 69 at System.Web.UI.Control.OnLoad(EventArgs e) at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
InnerException: System.DirectoryServices.DirectoryServicesCOMException
ErrorCode=-2147016651
ExtendedError=31
ExtendedErrorMessage="0000001F: SvcErr: DSID-031A0FC0, problem 5003 (WILL_NOT_PERFORM), data 0 "
Message="The server is unwilling to process the request. (Exception from HRESULT: 0x80072035)"
InnerException:
(AD server windows 2003 R2, .NET V2)