Thanks for looking!
Background
I am writing an API layer for a company that will be used by disparate apps and external consumers.
On the consumption end, most consumers will call a service via ajax using a jQuery $.post()
; however, Internet Explorer makes our lives more challenging (of course!). For IE, I must use the XDomainRequest
object because IE will not run a jQuery $.post()
and because if I use IE's XMLHttpRequest()
, I get a security message which is unacceptable (again--of course!):
Otherwise, XMLHttpRequest()
works fine.
I am using C#, .NET MVC 4 (WebApi)
Problem
The problem is that XDomainRequest
does not allow you to set the Content-Type
header and always defaults to text-plain
which MVC 4 WebApi controllers will not accept (and yet again--of course!!).
Question
How can I intercept requests for my controllers, detect the presence of text-plain
content types and change them to text-json
content-type on the fly?
Thanks in advance!