Search code examples
jqueryajaxrestopenrasta

Response issue with RESTful API using OpenRasta


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 ?


Solution

  • 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>