DomainContect is raising "Logon failure: unknown user name or bad password."

422 views Asked by At

I have the following code inside my asp.net mvc web application to retrieve the Active directory user names:-

public List<DomainContext> GetADUsers(string term=null)
{
    List<DomainContext> results = new List<DomainContext>();

    using (var context = new PrincipalContext(ContextType.Domain, "v800047"))
    using (var searcher = new PrincipalSearcher(new UserPrincipal(context)))
    {

the above was working well on our development environment, but when i moved my code to the staging server and i changed the AdServerName accordingly , i am getting the following error :-

Description: An unhandled exception occurred during the execution of the current 
web request. Please review the stack trace for more information about the error 
and where it originated in the code. 

 Exception Details: System.DirectoryServices.DirectoryServicesCOMException: 
     Logon failure: unknown user name or bad password.
0

There are 0 answers