LDAP invalid credentials - Active Directory Windows Server 2012 R2











up vote
0
down vote

favorite












I have not worked with Active Directory before and I need to make a connection between Unity standalone implementation in C# and Active Directory installed on a Windows Server 2012 R2 via LDAP. Every time I connect, I get the same error:




LdapException: (49) Invalid Credentials
LdapException: Server Message: 8009030C: LdapErr: DSID-0C0903C5, comment: AcceptSecurityContext error, data 2030, v2580




And I am sure that my username and password are correct.



DirectoryEntry entry = new DirectoryEntry("LDAP://"+ serverName+":"+port,userName,password);

DirectorySearcher ds = new DirectorySearcher(entry);

ds.Filter = "XX";

SearchResult result = ds.FindOne();
ResultPropertyCollection rpc = result.Properties;
foreach (string property in rpc.PropertyNames)
{
foreach (object value in rpc[property])
console.text+="Property = " + property + "Value = " + value;
}
}
catch (Exception ex)
{
Debug.Log(ex);
}


I already tried with LdapAdmin (open-source LDAP directory management tool) but I received the same error even with ldp command line in windows PowerShell. Any help will be appreciated.
Screenshot










share|improve this question




















  • 2




    Can you show your code?
    – Gabriel Luci
    Nov 22 at 17:27






  • 1




    What is the format of the username in userName? Is it domainusername or username@domain.com? (please edit your question rather than adding an answer)
    – Gabriel Luci
    Nov 23 at 12:54










  • I tried both but with the same error, can you check the screenshot that I recently added ? Thank you for your time.
    – Wajdi Mnasri
    Nov 23 at 13:28












  • See the answer below. There must be a typo in your username. It's not lying to you :)
    – Gabriel Luci
    Nov 23 at 13:34















up vote
0
down vote

favorite












I have not worked with Active Directory before and I need to make a connection between Unity standalone implementation in C# and Active Directory installed on a Windows Server 2012 R2 via LDAP. Every time I connect, I get the same error:




LdapException: (49) Invalid Credentials
LdapException: Server Message: 8009030C: LdapErr: DSID-0C0903C5, comment: AcceptSecurityContext error, data 2030, v2580




And I am sure that my username and password are correct.



DirectoryEntry entry = new DirectoryEntry("LDAP://"+ serverName+":"+port,userName,password);

DirectorySearcher ds = new DirectorySearcher(entry);

ds.Filter = "XX";

SearchResult result = ds.FindOne();
ResultPropertyCollection rpc = result.Properties;
foreach (string property in rpc.PropertyNames)
{
foreach (object value in rpc[property])
console.text+="Property = " + property + "Value = " + value;
}
}
catch (Exception ex)
{
Debug.Log(ex);
}


I already tried with LdapAdmin (open-source LDAP directory management tool) but I received the same error even with ldp command line in windows PowerShell. Any help will be appreciated.
Screenshot










share|improve this question




















  • 2




    Can you show your code?
    – Gabriel Luci
    Nov 22 at 17:27






  • 1




    What is the format of the username in userName? Is it domainusername or username@domain.com? (please edit your question rather than adding an answer)
    – Gabriel Luci
    Nov 23 at 12:54










  • I tried both but with the same error, can you check the screenshot that I recently added ? Thank you for your time.
    – Wajdi Mnasri
    Nov 23 at 13:28












  • See the answer below. There must be a typo in your username. It's not lying to you :)
    – Gabriel Luci
    Nov 23 at 13:34













up vote
0
down vote

favorite









up vote
0
down vote

favorite











I have not worked with Active Directory before and I need to make a connection between Unity standalone implementation in C# and Active Directory installed on a Windows Server 2012 R2 via LDAP. Every time I connect, I get the same error:




LdapException: (49) Invalid Credentials
LdapException: Server Message: 8009030C: LdapErr: DSID-0C0903C5, comment: AcceptSecurityContext error, data 2030, v2580




And I am sure that my username and password are correct.



DirectoryEntry entry = new DirectoryEntry("LDAP://"+ serverName+":"+port,userName,password);

DirectorySearcher ds = new DirectorySearcher(entry);

ds.Filter = "XX";

SearchResult result = ds.FindOne();
ResultPropertyCollection rpc = result.Properties;
foreach (string property in rpc.PropertyNames)
{
foreach (object value in rpc[property])
console.text+="Property = " + property + "Value = " + value;
}
}
catch (Exception ex)
{
Debug.Log(ex);
}


I already tried with LdapAdmin (open-source LDAP directory management tool) but I received the same error even with ldp command line in windows PowerShell. Any help will be appreciated.
Screenshot










share|improve this question















I have not worked with Active Directory before and I need to make a connection between Unity standalone implementation in C# and Active Directory installed on a Windows Server 2012 R2 via LDAP. Every time I connect, I get the same error:




LdapException: (49) Invalid Credentials
LdapException: Server Message: 8009030C: LdapErr: DSID-0C0903C5, comment: AcceptSecurityContext error, data 2030, v2580




And I am sure that my username and password are correct.



DirectoryEntry entry = new DirectoryEntry("LDAP://"+ serverName+":"+port,userName,password);

DirectorySearcher ds = new DirectorySearcher(entry);

ds.Filter = "XX";

SearchResult result = ds.FindOne();
ResultPropertyCollection rpc = result.Properties;
foreach (string property in rpc.PropertyNames)
{
foreach (object value in rpc[property])
console.text+="Property = " + property + "Value = " + value;
}
}
catch (Exception ex)
{
Debug.Log(ex);
}


I already tried with LdapAdmin (open-source LDAP directory management tool) but I received the same error even with ldp command line in windows PowerShell. Any help will be appreciated.
Screenshot







active-directory ldap windows-server-2012-r2






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 23 at 13:24

























asked Nov 22 at 17:20









Wajdi Mnasri

42




42








  • 2




    Can you show your code?
    – Gabriel Luci
    Nov 22 at 17:27






  • 1




    What is the format of the username in userName? Is it domainusername or username@domain.com? (please edit your question rather than adding an answer)
    – Gabriel Luci
    Nov 23 at 12:54










  • I tried both but with the same error, can you check the screenshot that I recently added ? Thank you for your time.
    – Wajdi Mnasri
    Nov 23 at 13:28












  • See the answer below. There must be a typo in your username. It's not lying to you :)
    – Gabriel Luci
    Nov 23 at 13:34














  • 2




    Can you show your code?
    – Gabriel Luci
    Nov 22 at 17:27






  • 1




    What is the format of the username in userName? Is it domainusername or username@domain.com? (please edit your question rather than adding an answer)
    – Gabriel Luci
    Nov 23 at 12:54










  • I tried both but with the same error, can you check the screenshot that I recently added ? Thank you for your time.
    – Wajdi Mnasri
    Nov 23 at 13:28












  • See the answer below. There must be a typo in your username. It's not lying to you :)
    – Gabriel Luci
    Nov 23 at 13:34








2




2




Can you show your code?
– Gabriel Luci
Nov 22 at 17:27




Can you show your code?
– Gabriel Luci
Nov 22 at 17:27




1




1




What is the format of the username in userName? Is it domainusername or username@domain.com? (please edit your question rather than adding an answer)
– Gabriel Luci
Nov 23 at 12:54




What is the format of the username in userName? Is it domainusername or username@domain.com? (please edit your question rather than adding an answer)
– Gabriel Luci
Nov 23 at 12:54












I tried both but with the same error, can you check the screenshot that I recently added ? Thank you for your time.
– Wajdi Mnasri
Nov 23 at 13:28






I tried both but with the same error, can you check the screenshot that I recently added ? Thank you for your time.
– Wajdi Mnasri
Nov 23 at 13:28














See the answer below. There must be a typo in your username. It's not lying to you :)
– Gabriel Luci
Nov 23 at 13:34




See the answer below. There must be a typo in your username. It's not lying to you :)
– Gabriel Luci
Nov 23 at 13:34












1 Answer
1






active

oldest

votes

















up vote
1
down vote













It's obscure, but the reason you got denied is in the error message. The real error is the value of the data field. In this case, the error is 0x2030.



Convert the value to decimal to get 8240.



Then do a lookup of the error. The FormatMessage API will give you that, or on the command line, you would do:



net helpmsg 8240


And you would get



There is no such object on the server.


That means the username you are using does not exists, has a typo, etc.






share|improve this answer























    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53435749%2fldap-invalid-credentials-active-directory-windows-server-2012-r2%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    1
    down vote













    It's obscure, but the reason you got denied is in the error message. The real error is the value of the data field. In this case, the error is 0x2030.



    Convert the value to decimal to get 8240.



    Then do a lookup of the error. The FormatMessage API will give you that, or on the command line, you would do:



    net helpmsg 8240


    And you would get



    There is no such object on the server.


    That means the username you are using does not exists, has a typo, etc.






    share|improve this answer



























      up vote
      1
      down vote













      It's obscure, but the reason you got denied is in the error message. The real error is the value of the data field. In this case, the error is 0x2030.



      Convert the value to decimal to get 8240.



      Then do a lookup of the error. The FormatMessage API will give you that, or on the command line, you would do:



      net helpmsg 8240


      And you would get



      There is no such object on the server.


      That means the username you are using does not exists, has a typo, etc.






      share|improve this answer

























        up vote
        1
        down vote










        up vote
        1
        down vote









        It's obscure, but the reason you got denied is in the error message. The real error is the value of the data field. In this case, the error is 0x2030.



        Convert the value to decimal to get 8240.



        Then do a lookup of the error. The FormatMessage API will give you that, or on the command line, you would do:



        net helpmsg 8240


        And you would get



        There is no such object on the server.


        That means the username you are using does not exists, has a typo, etc.






        share|improve this answer














        It's obscure, but the reason you got denied is in the error message. The real error is the value of the data field. In this case, the error is 0x2030.



        Convert the value to decimal to get 8240.



        Then do a lookup of the error. The FormatMessage API will give you that, or on the command line, you would do:



        net helpmsg 8240


        And you would get



        There is no such object on the server.


        That means the username you are using does not exists, has a typo, etc.







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Nov 23 at 13:04









        Gabriel Luci

        9,17811224




        9,17811224










        answered Nov 23 at 12:59









        ixe013

        7,12523360




        7,12523360






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.





            Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


            Please pay close attention to the following guidance:


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53435749%2fldap-invalid-credentials-active-directory-windows-server-2012-r2%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            What visual should I use to simply compare current year value vs last year in Power BI desktop

            How to ignore python UserWarning in pytest?

            Alexandru Averescu