Quantcast
Channel: Security
Viewing all articles
Browse latest Browse all 4737

principalcontext validatecredentials performance promblem

$
0
0

HI,

First sorry for my poor English.

I am runing a web site,I use PrincipalContext Class to validate people over Microsoft Active Directory. There a re more than 500 thousand people account in the AD. I  run into a  problem that ten thousand user login in my web site at the same time.The cannot login quickly.

I wrote a static class to do the job validate people like this

PrincipalContext principalContext = new PrincipalContext(ContextType.Domain, StsDomainName, StsAdRootOu + "," + StsDomainDn , ContextOptions.SimpleBind,StsAdUserName, StsAdUserPswd);
if (principalContext.ValidateCredentials(@"hnteacher\" + userName, password,ContextOptions.SimpleBind))
      result = "1";
else
      result = "0";

validate people will cost more then five second time when those user login at the same time.

if i set a principalContext object as a static member of . validate people will be very quick.But the CPU Usage of the web server will raise to 90%.

How can i improve my code


Viewing all articles
Browse latest Browse all 4737

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>