2

I have a webmethod in aspx page and I am calling it through jquery Ajax method.

In one server I am getting windows security prompt on ajax call (all other servers are working fine). When I was checking using fiddler I see a 301 redirect of my method call(webmethods.aspx/GetDetails to webmethods.aspx/GetDetails/)

Not sure why the redirect is happening on one server and call to webmethod.aspx/GetDetails/ is throwing 401. I checked all the wildcard mapping etc and not able to find any issues. Any idea where else I need to check?

Here is my code

 $.ajax({
            type: "POST",
            url: "/webmethods.aspx/GetDetails",
            data: "",
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            success: function (response) {
                //alert('success');
            },
            failure: function (response) {
                alert(response);
            },
            error: function (jqXHR, textStatus, errorThrown) {
                var errMessage = "An error occured serving your request. Please try again.";
                if (jqXHR)
                    errMessage = $.parseJSON(jqXHR.responseText).Message;
                alert(errMessage);
            }
Tippu
  • 1,191
  • 4
  • 16
  • 36
  • 1
    Maybe you need to check if you have any redirect from http to https ? – Aristos May 02 '13 at 00:51
  • Thanks for your comments. The server where I have issue is not in https, SSL is not even installed on that server. – Tippu May 02 '13 at 00:55
  • 2
    Have you already read this: http://stackoverflow.com/questions/12386272/301-redirect-on-ajax--redirected ? And another thing: I saw in your question that you have `url: "/webmethods.aspx/GetDetails"` , upper you were mentioning _...301 redirect of my method call(**webmethod**.aspx/GetDetails to **webmethod**.aspx/GetDetails/)..._. Or is this only a typo here? – uross May 02 '13 at 19:08
  • Yeah that is a typo. I fixed it now – Tippu May 03 '13 at 14:02

1 Answers1

1

Can you check the handler order in your web.config? I have had similar issue where staticfile handler was before aspx handler. Changing the order fixed my issue (move the static file as the last element, because most of the time it will have verify whether file exists before handling).