How do i verify the user (Passing Username and password to LDAP User Auth) in Active directory using javascript?
<p>I have created a Web Service and made an Ajax call to verify that user has access to Active Directory. It is working when we access through intranet but i am getting an error when the site is accessed through web. Here is my code snippet:</p>

<p>jQuery.support.cors = true;</p>

<pre><code>    $("#dialog-form").dialog({
        autoOpen: false,
        height: 330,
        width: 380,
        cache: false,
        modal: true,
        buttons: {
            "Authenticate": function () {
                var bValid = true;
                allFields.removeClass("ui-state-error");
                bValid = bValid &amp;&amp; checkLength(name, "Username", 1, 30);

                if (!LoginUserCheck(name.val()) &amp;&amp; bValid) {
                    updateTips("The Username entered here should match with Username used for logging into the system");
                }

                bValid = bValid &amp;&amp; checkLength(password, "Password", 1, 30);
                bValid = bValid &amp;&amp; LoginUserCheck(name.val());

                if (bValid) {
                    var dataString = "{'username':'" + name.val() + "' ,password: '" + password.val() + "'}";
                    $.ajax({
                        type: "POST",
                        contentType: "application/json; charset=utf-8",
                        url: "http://192.168.12.186:5327/LDAPService.asmx/LADPAuthenticationCheck",
                        data: dataString,
                        dataType: "json",
                        beforeSend: function (xhr) { xhr.setRequestHeader('Access-Control-Allow-Origin', '*'); },
                        success: function (msg) {
                            if (msg.d) {
                                $("#dialog-form").dialog("close");
                                $("#dialog").dialog("open");
                                // alert("MSG :" + msg.d);
                            }
                            else {
                                updateTips("Incorrect Username/Password");
                            }
                        },
                        error: function (jqXHR, textStatus, errorThrown) {
                            //                            $("#dialog").dialog("open");
                            alert("Error: " + errorThrown + " Please try to login with some other's system.");
                        }
                    });
                }
            },
            Cancel: function () {
                $("#dialog-form").dialog("close");
                $('#&lt;%= hdnCancel.ClientID %&gt;').trigger("click");
            }
        },
        close: function () {
            allFields.val("").removeClass("ui-state-error");
        }
    });

    $('#&lt;%= hdnTriggerDialog.ClientID %&gt;').click(function () {
        $("#dialog-form").dialog("open");
    });
});
</code></pre>

<p>I am doubting that cross domain fails when the site is accessed via Web. Can Anyone please help me to fix it?</p>

<p>Thanks - Ragu</p>