Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8861243
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T15:27:00+00:00 2026-06-14T15:27:00+00:00

As part of a solution to implement cross-browser, cross-domain support for an MVC4 web

  • 0

As part of a solution to implement cross-browser, cross-domain support for an MVC4 web application making ajax calls to an MVC4 web api application, I’m using the XDomainRequest object to provide support for cross-domain ajax calls made by IE < 10 clients.

I’m having trouble with POST operations which include JSON in the request body that I expect to be deserialized on the web api side.

When the call is made from IE < 10 using XDomainRequest, I can’t explicitly specify application/json as the content type of the request (because you can’t modify the headers when using XDomainRequest), so the JSON isn’t getting deserialized into to the type specified in the method signature.

Note that cross-domain GET operations work fine in all browsers, so I have my web api configured properly for CORS, etc.

Consider the following POST operation defined on the web api:

public int Customer(Customer customer) {}

Even when a Customer objected represented as JSON is present in the body of the request, customer is always null when the call is made using XDomainRequest using IE < 10. This happens because the request generated by XDomainRequest is missing the content-type: application/json request header.

Is there a way to handle this on the web api side so that I can force the JSON body to be properly deserialized even when the content type isn’t specified in the request?

I’ve read about model binders but unclear if this is what they are intended for.

Here’s my XDomainRequest code for reference (fyi that this is part of a function which uses jQuery.ajax for all browsers except IE < 10):

var xdr = new XDomainRequest();
if (xdr) {
    xdr.open(method, url);
    xdr.onload = function() {
        var result = $.parseJSON(xdr.responseText);
        if (result == null || typeof(result) == 'undefined') {
            result = $.parseJSON(data.firstChild.textContent);
        }
        doneCallback(result);
    };
    xdr.onerror = function() {
        failCallback();
    };
    xdr.onprogress = function() {
    };
    xdr.send(data);
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T15:27:01+00:00Added an answer on June 14, 2026 at 3:27 pm

    you could write a delegating message handler where you set incoming request content’ content-type header to be application/json if not already present.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Part of my web application is a background script that polls from a beanstalkd
I need to implement authentication in a php app but using fingerprint as part
I need to implement a small part of my application logic in native code.
How do you implement a multiselect combobox as part of a Ext.FormPanel using ExtJs?
I have a custom web application that integrates with a SharePoint (MOSS 2007) solution.
I'm trying to implement the pseudo solution below in java as part of an
im looking forward for a 3rd part tool/solution that can monitor my server's network
Part of the solution to my problem I found here: How to calculate correlation
As part of the solution to How do I control the screensaver name shown
I've encountered a problem where part way through building a solution, VS 2010 becomes

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.