Re: DirectoryEntry.Invoke("SetPassword") slow

From: Joe Kaplan \(MVP - ADSI\) (joseph.e.kaplan_at_removethis.accenture.com)
Date: 08/29/04


Date: Sun, 29 Aug 2004 15:06:07 -0500

It could be related to an SSL problem on the server. SetPassword tries to
use SSL/LDAP under the hood to create an encrypted channel to the server.
Sometimes SSL binds can be slow due to client certificates and such. I'd
check the event log on the machine making the call for Schannel errors in
the System log.

Joe K.

"Oleg Ogurok" <oleg@ogurok.com.ihatespammers.ireallydo.co> wrote in message
news:10j27ll4hr4699a@corp.supernews.com...
> Hi all,
>
> I'm having problems setting password for user in Active Directory via
> LDAP/ADSI.
> In one environment it works fine, on another domain this line takes a
minute
> or two to execute:
> Invoke("SetPassword", new object[] { pass }).
>
> Any other line executes quickly.
> The code never fails, it just takes long time to finish.
>
> Here's my code:
>
> public void AddUser(string userName, string domain, string firstName,
> string lastName, string password)
> {
> using (DirectoryEntry adminEntry = new DirectoryEntry(ldapPath, null,
> null, AuthenticationTypes.Secure))
> {
> object native = entry.NativeObject; // to force auth
> string fullName = firstName + " " + lastName;
> using (DirectoryEntry deUser = adminEntry.Children.Add("cn=" +
fullName,
> "user"))
> {
> string domainAndUserName = userName + "@" + domain;
>
> deUser.Properties["userPrincipalName"].Add(domainAndUserName);
> deUser.Properties["sAMAccountName"].Add(userName);
> deUser.Properties["sn"].Add(lastName);
> deUser.Properties["displayName"].Add(fullName);
> deUser.Properties["givenName"].Add(firstName);
> deUser.Properties["description"].Add("Added via MyProgram");
> deUser.CommitChanges();
> // User has to be saved prior to this step
> deUser.Invoke("SetPassword", new object[] {password} ); // THIS LINE
> IS SLOW !!!!
>
> // Create a normal account and enable it - ADS_UF_NORMAL_ACCOUNT
> deUser.Properties["userAccountControl"].Value = 0x200;
> deUser.CommitChanges();
> }
> }
> }
>
>
> Thanks,
> -Oleg.
>
>



Relevant Pages

  • Help: OWSADM hangs when executing from C# web service
    ... admin user and providing the login credentials through the ... string output = process.StandardOutput.ReadToEnd; ... For some reason when I execute the Startmethod then the OWSADM hangs ... The machine is running Windows Server 2003 Enterprise edition. ...
    (microsoft.public.dotnet.framework.aspnet.security)
  • Impersonate second session require restart of IIS
    ... 2000 Server with latest security pacx and service pacs) ... Cannot execute a program. ... (IntPtr userToken, String cmd, String currentDir, ... (CompilerParameters options, String compilerDirectory, ...
    (microsoft.public.dotnet.framework.aspnet.security)
  • Re: gute Beschreibung zu DdeClientTransaction()
    ... DDE- Server aus dem Client heraus starte. ... Server noch keine "execute" Anfragen akzeptieren ... Wo soll den die Länge vom String angegeben werden? ... HDDEDATA hData = DdeCreateDataHandleszCommand, ...
    (microsoft.public.de.vc)
  • Dynamic compilation errors
    ... Timed out waiting for a program to execute. ... userToken, String cmd, String currentDir, TempFileCollection tempFiles, ... String cmd, String currentDir, TempFileCollection tempFiles, String& ... people suggest it involves IISLockdown which we have on our server. ...
    (microsoft.public.dotnet.framework.aspnet)
  • SQL Connection Problem
    ... An error has occurred while establishing a connection to the server. ... database location within the applications App_Data directory. ... Boolean& failoverDemandDone, String host, String failoverPartner, String ... user, String password, Boolean trusted, String connectionString) +68 ...
    (microsoft.public.dotnet.framework.aspnet)