Search code examples
c#asp.net-web-apicontent-type

how to ask webapi for a specific content type


as I understood from ASP.net MVC 4 Release notes, is that it has Content Negotiation, and that it will return the content type requested by the client

how is the client asking for a specific content ?

(in my case would be flash asking for XML, using AMF)


Solution

  • Like vansimke said, you just set the content type you need.

    In the ActionScript client, it should be as easy as:

    request.setHeader("Accept", "application/xml"); 
    

    The server then respons with the header "Content-Type".

    response.setHeader("Content-Type", "application/xml"); 
    

    Hope that helps!

    Edit: headers wrong.