DirectoryServicesCOMException encountered UserPrincipal.FindByIdentity(pc, userName)

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • KISHOR J

    #1

    DirectoryServicesCOMException encountered UserPrincipal.FindByIdentity(pc, userName)

    I am trying to hook up with Active directory to get the Group of the user using System.Director yServices.Accou ntManagement.
    When I am running the Application from VS2010 it Authenticate user and Display the Group as well.
    But when I am browsing application from IIS 5.1 it showing error while checking the group.

    “System.Directo ryServices.Dire ctoryServicesCO MException: Logon failure: unknown user name or bad password.”

    PrincipalContex t pc = new PrincipalContex t(ContextType.D omain, “TEST1″)
    On Sentence
    UserPrincipal.F indByIdentity(p c, userName);



    Please find the code of GetPrincipalCon tect as given below.
    Code:
    public PrincipalContext GetPrincipalContext()
    {
      PrincipalContext oPrincipalContext = new PrincipalContext(ContextType.Domain, “TEST1″);
      return oPrincipalContext;
    }


    Kindly provide some help.
    Last edited by Frinavale; Oct 6 '10, 03:44 PM. Reason: Please post code in [code] ... [/code] tags. Added code tags and formatted the error message.
Working...