ADSI Performance...

L

LamSoft

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";
}
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,189
Latest member
CryptoTaxSoftware

Latest Threads

Top