0

I am implementing RESTful API using OpenRasta.I am sending a ajax request in the following manner.

   $.ajax("login", {
            type: "post",
            data: JSON.stringify(authData),
            success: function (data, textStatus, jqXHR) {
            },
            error: function (jqXHR, textStatus, errorThrown) {
            },
            async: true
          });

I am firing this request on button click.This same request is giving different response when i am doing it locally (http://localhost/myApplicationName) and when i am doing on hosted website (http://myCompany.com).I am expecting the Bad Request(400) with some additional info(shown in figure 1) in response for this request.Its working fine locally(shown in figure 1) ,but on deployed website i am getting string "Bad Request" in response with status 400(shown in figure 2) .Following is the response i am getting locally.

local response

And response for the same from deployed website

enter image description here

I tried to figure out this issue but could not reach at any conclusion.Is this the issue with the deployment or am i making some mistake in error handling ?

IsmailS
  • 10,797
  • 21
  • 82
  • 134
prashant
  • 2,181
  • 2
  • 22
  • 37
  • Is the URL local ? ie on the same domain ? – Manse Mar 07 '12 at 13:50
  • URL is not local.Its on other domain (http://domainname/login) which is hosted on other server. – prashant Mar 07 '12 at 18:05
  • Have you tried looking at the log on the server? How are you hosting it? What's the IIS log saying? – SerialSeb Mar 07 '12 at 18:33
  • I am hosting it by adding a website to Site node in IIS.Are there any additional steps for hosting RESTful websites? This is the IIS log I got. `2012-03-12 04:52:56 192.168.2.2 POST /login - 80 - 192.168.2.14 Mozilla/5.0+(Windows+NT+6.1;+rv:10.0.2)+Gecko/20100101+Firefox/10.0.2 400 0 0 1881` – prashant Mar 12 '12 at 05:31

1 Answers1

0

I did some web search on this issue and found a similar post on https://groups.google.com/d/msg/openrasta/UKyQSNjkp34/Lm8jqzawm8MJ . Found the solution for the issue by putting this in web.config.

<httpErrors errorMode="Detailed" existingResponse="PassThrough">
 <clear />
</httpErrors>
IsmailS
  • 10,797
  • 21
  • 82
  • 134
prashant
  • 2,181
  • 2
  • 22
  • 37