Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
Mono organizations on
GitHub to continue tracking issues. Bugzilla will remain
available for reference in read-only mode. We will continue to work
on open Bugzilla bugs, copy them to the new locations
as needed for follow-up, and add the new items under Related
Our sincere thanks to everyone who has contributed on this bug
tracker over the years. Thanks also for your understanding as we
make these adjustments and improvements for the future.
Please create a new report for Bug 7889 on
GitHub or Developer Community if you have new
information to add and do not yet see a matching new report.
If the latest results still closely match this report, you can use the
In special cases on GitHub you might also want the comments:
GitHub Markdown with public comments
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.