Note that there are some explanatory texts on larger screens.

plurals
  1. POPerformance problems when using PrincipalContext.ValidateUser
    text
    copied!<p>I am using the solution discussed <a href="https://stackoverflow.com/questions/726837/user-group-and-role-management-in-net-with-active-directory">here</a> to authenticate users against the active directory in my ASP.NET web application. I've written a simple ADMembershipProvider class thas is used together with FormsAuthentication. Works fine when running the project locally but when deployed to a server in the network, the ValidateUser call takes really long time (approx 20s).</p> <pre><code>//Assumes using System.DirectoryServices.AccountManagement public override bool ValidateUser(string username, string password) { using (var context = new PrincipalContext(ContextType.Domain)) { return context.ValidateCredentials(username, password); } } </code></pre> <p>I tried to add <em>name</em> and <em>container</em> parameters as documented on <a href="http://msdn.microsoft.com/en-us/library/bb348316.aspx" rel="nofollow noreferrer">msdn</a> to the PrincipalContext constructor, but these parameters doesn't seem to have any effect whatsoever.</p> <pre><code>using (var context = new PrincipalContext(ContextType.Domain, "MyDomain", "OU=MyCompany,DC=some,DC=stuff")) { return context.ValidateCredentials(username, password); } </code></pre> <p>We have the same problem on at least two different servers in our network. The servers are connected to the AD and running OS Windows server 2003 SP2 (IIS6)</p> <p>One idea I had was that the issue might be connected to the fact that our domain has some trusts to other domains, and that they are somehow involved when validating the user. However, the users we are trying to validate exists exclusively in "our" AD.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload