Description of problem: (ASP.NET under Mono on linux)
Using HttpContext context.Response.Headers.Add("Content-Type", "image/jpeg") results in a content type of "text/html" being sent to the client; however, using context.Response.ContentType = "image/jpeg" results in the corrent MIME type being sent to the client. The exact MIME type does not appear to matter, "image/jpeg" just happened to be what I was working with. The HttpContext is obtained via the ProcessRequest method of an IHttpHandler. Other headers such as ETag, Last-Modified, and Content-Length are correctly sent to the client, the only affected header appears to be Content-Type.
Steps to reproduce:
1) Create a simple IHttpHandler class and add a custom content type via context.Response.Header.Add.
2) Request the handler class via a client and examine the Content-Type header (I was using FireFox and FireBug).
The Content-Type header has the (default?) value of "text/html" instead of the value specified by the header that was added to the handler.
The Content-Type header sent to the client has the value specified by the header added to the handler.
Mono JIT compiler version 2.10.6 (tarball Wed Aug 15 11:55:02 UTC 2012)
Copyright (C) 2002-2011 Novell, Inc, Xamarin, Inc and Contributors. www.mono-project.com
Misc: debugger softdebug
LLVM: supported, not enabled.
GC: Included Boehm (with typed GC and Parallel Mark)
OS: openSUSE 12.2 x64
Web Server: Apache 2.2.22
ASP.NET version: 2.0.50727 (as sent by the X-AspNet-Version header, the project file targets .NET 3.5)
While running this on a Windows 7 x64/IIS7/.NET environment the correct content type is sent, this only happens when the HTTP handler is running under linux/apache/mono.
Specifying the content type via context.ContentType = "image/jpeg" produces the expected result.
Oops, my apologies. Yes, it is a System.Web.HttpContext object.