ADSI Performance...

Discussion in 'ASP .Net' started by LamSoft, Jun 15, 2007.

  1. LamSoft

    LamSoft Guest

    I found that getting values using ADSI From other 2003 server-based is very
    slow, if the script (ASP.NET) is also running on Windows 2003 Server.

    But when I develop the script on my Windows XP on the same network, it runs
    very fast, here is the output from the browser on Windows Server 2003:

    1 6/15/2007 10:26:54 AM
    2 6/15/2007 10:27:09 AM
    1 6/15/2007 10:27:10 AM
    2 6/15/2007 10:27:25 AM
    1 6/15/2007 10:27:25 AM
    2 6/15/2007 10:27:40 AM

    The function has been called for 3 times and I found that a statement is
    running slow (nearly 15 seconds), why is it only happen on Windows 2003
    Server, but no problem on Windows XP? Thank you

    private String checkAccountStatus(String ServerName, String username)
    {
    DirectoryEntry myDirectoryEntry;
    if (ServerName == "LocalHost")
    {
    ServerName =
    System.Configuration.ConfigurationManager.AppSettings["LocalServerName"];
    myDirectoryEntry = new DirectoryEntry(@"WinNT://" + ServerName +
    "/" + username + ",user",
    (String)Session["Server_Username"],
    (String)Session["Server_Password"]);
    }
    else
    {
    myDirectoryEntry = new DirectoryEntry(@"WinNT://" + ServerName +
    "/" + username + ",user", (String)Session["Server_Username"],
    (String)Session["Server_Password"]);
    }

    if (myDirectoryEntry != null)
    {
    Response.Write("1 " + DateTime.Now + "<br>");
    int flag = (int)myDirectoryEntry.Properties["userFlags"].Value;
    Response.Write("2 " + DateTime.Now + "<br>");
    if (Convert.ToBoolean(UF_ACCOUNTDISABLE & flag))
    {
    return "Disabled";
    }
    else
    {
    return "Enabled";
    }
    }
    return "Disabled";
    }
    LamSoft, Jun 15, 2007
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Justin Rich

    ADSI - Syntax for msExchTurfListNames

    Justin Rich, Jun 26, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    957
    Justin Rich
    Jun 26, 2003
  2. khaja shaik

    ADSI/LDAP Query

    khaja shaik, Jul 21, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    610
    khaja shaik
    Jul 21, 2003
  3. Roy Osherove

    Access Denied for WMI/ADSI over ASP.Net

    Roy Osherove, Sep 9, 2003, in forum: ASP .Net
    Replies:
    3
    Views:
    7,119
    s.becker
    Sep 14, 2003
  4. venkat

    Retrieve logon user name from ADSI

    venkat, Nov 6, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    457
    venkat
    Nov 6, 2003
  5. shiv

    ADSI - User A/c Info Question

    shiv, Nov 14, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    343
    Natty Gur
    Nov 16, 2003
Loading...

Share This Page