Wrangling Control of HTTP Headers in ASP.NET

Posted by Andrew Burgess on Stack Overflow See other posts from Stack Overflow or by Andrew Burgess
Published on 2012-04-01T23:23:24Z Indexed on 2012/04/01 23:29 UTC
Read the original article Hit count: 333

Filed under:
|
|

I'm working with ASP.NET MVC3, and I'm trying to get absolute control over my headers because a client application that I'm working with expects a very specific content type. What I'm finding when using Fiddler to examine the HTTP traffic is that the text encoding is being returned as part of the header.

For example, the client is expecting application/appname in the Content-Type header, but the server is returning application/appname; charset=utf-8. I think the client is using a strict comparison for checking the type, so I want to be able to specify exactly what is emitted in the headers.

Right now I have a custom ActionResult in which I clear the headers and then specify only the content type, but the encoding still seems to be added on.

How can I remove the encoding from the Content-Type header?

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about asp.net-mvc