I'm working on building some web pages for testing various vulnerability scenarios, but ASP.Net, or IIS, is doing too good a job of protecting me from myself.
One of the things I'm trying to do is return responses with various Content-Type headers, with and without charset declarations. The problem I that if I leave out the charset, then ASP.Net seems to add in utf-8 by default.
In my ASPX.cs code-behind, if I have Response.AddHeader("Content-Type", "text/html")
or Page.ContentType = "test/html"
, I would expect to see the following header returned by the page:
Content-Type: text/html
Instead I get:
Content-Type: text/html; charset=utf-8
If I use Response.AddHeader("Content-Type", "text/html; charset=iso-8859-1")
then I get the expected header:
Content-Type: text/html; charset=iso-8859-1
Is there a way to stop ASP.Net (IIS?) from appending charset=utf-8
to the header when I don't want it?
I'm using ASP.Net 4.0 and IIS 7.5.
Try this:
Response.Charset = "";
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With