I'd like to set the default content-type for web pages in my ASP.NET MVC application to text/html.
I know this can be done by adding a ContentType="text/html" to all of my <%Page%> elements, but I'd prefer to use the web.config instead. How can I do that?
Thanks,
Adrian
Edit: I know that "text/HTML" is the ASP.NET default, but for unknown reasons Opera still tries to parse my web site as XHML unless I explicitly set the content-type in my <%Page%> element.
We had the exact same problem and the issue for us was that the mobile.browser file we got from CodePlex has a bug that forces asp.net to always tell the desktop version of opera that we are sending them xhtml. I removed the mobile.browser file and it resolved the issue. It seems the only thing we could find that would override the directive from the mobile.browser was to specify the ContentType="text/html" on each views <%@ Page %> tag. Even setting the content type in global.asax made zero difference.
UPDATE: I have found that removing all of capability nodes with a name of "preferredRenderingMime" from the mobile.browser file will fix this issues and still allows us to identify mobile browsers.
Content type for aspx views is already set to text/html
.
Content-Type: text/html; charset=utf-8
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