0

I am trying to call a web service that is located on a web server that requires web form authentication

 $.ajax({
                    type: "Get",
                    url: "http://SomeIPAddressThatIDontWantToShare/WebServices/GetServerData.asmx/GetOPCHist_Last4h",
                    data: { OPCName: OPCName_Passed, OPCTable: OPCTable_Passed },
                    contentType: "application/json; charset=utf-8",
                    dataType: "json",
                    success: function (data) {
                        $.each(data, function (index, element) {
                            T1.push([new Date(element.DateAndTime).getTime(), element.T1]);
                        });
                    },
                    error: function (request, status, error) {
                        alert(request.status + ' ' + request.responseText);
                    }
                })

However when doing so it always hits the error state with a state of "0" and nothing for the responseText. I manually authenticated on the browser before hitting the page.

So the question is, do I have to do web form authentication from javascript, and if so how?

Also is this error even related to web form authentication or is status of 0 possibly something totally different.

I verified I can access that webservice once I log in from a browser.

1 Answer 1

1

If your service is under webforms protection, you have to, of course, login first. Check this to try to remove webforms protection for your ws. Or you can try this one to work within webforms.

I hope this can help you.

Sign up to request clarification or add additional context in comments.

1 Comment

This is exactly what I was looking for, while leaving the web service outside of webform protection will not work for us the second solution works perfectly. Thanks so much for your help!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.