none
How to assign a dedicate domain controller server in PrincipalContext constructor RRS feed

  • Question

  • I have an existing web site use PrincipalContext to validate user credentials by below code:

    Using ct As PrincipalContext = New PrincipalContext(ContextType.Domain, "CORP")
                IsValid = ct.ValidateCredentials(txtWindowsAccount.Text, txtWindowsPassword.Text)
            End Using

    This code works in the ASP.NET web site. But this code will choose DC in different place randomly so some times it time outs.

    Now admin team hope to assign a dedicate DC server in the contructor, and I tried this code in an console appliction:

    Using ct As PrincipalContext = New PrincipalContext(ContextType.Domain, "CORP", "DC=NTTWTP003")

    OR

    Using ct As PrincipalContext = New PrincipalContext(ContextType.Domain, "NTTWTP003")

    But both return the same error: The server cannot handle directory requests.

    So my question is, is the error caused by I'm using a console application, or some incorrect parameters I used in the PrincipalContext constructor?


    Alex Du

    • Moved by Mike Feng Wednesday, November 28, 2012 9:08 AM (From:.NET Base Class Library)
    Tuesday, November 27, 2012 4:11 AM

All replies