tags:

views:

208

answers:

2

When I try to access a page, I got an error like below, but I can view the full source code, the source code has no problem, I have no idea why IIS7 tells my browser the XHTML page is an XML? (It's not my browser's problem, cuz I asked my friends to test and he got the same result)

XML Parsing Error: not well-formed Location: http://www.xxxx.com/xxx.htm Line Number 44, Column 239:

The strange thing is, after restarting the IIS7, the page works well again, but maybe several hours later, another page will get the exact same error. This problem drives me crazy...

A: 

XHTML is XML. That's kinda the point. It should be sent as application/xhtml+xml by the webserver, but IE still throws a fit if it encounters that content-type. Nevertheless, that is the correct way for a webserver to send XHTML data.

If your XHTML file can not be parsed as valid XML, then it is not valid XHTML either, and unlike HTML, the browser will generate an error, just like you're seeing. The XHTML standard requires it to do that, instead of trying to interpret some malformed tag soup, like a HTML parser would.

jalf
But at least it has some problem with IIS, as I mentioned, when I restarted IIS, the page work well then. And just now, another strange thing happens, when I try to access a page, FireFox asks me to download (a download dialog shows up), for the same page, when I use Chrome, it only displays source code, after restarting IIS (or just the site) it works fine again! It's really weird...
silent
Which content-type are the browsers seeing?
jalf
The content-type in the html code is writen like this:<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />I just tried to use Fiddler to monitor what was happened, Fiddler says the page content-type is text/vnd.wap.wml; charset=utf-8Could you please tell me how to force IIS to output pages in text/html content-type?
silent
A: 

go into your mime-types section in INETMGR and add .xhtml as application/xhtml+xml this is the correct mime-type which IIS will deliver with that file type, otherwise it pulls whatever is configured in the registry.

stinkbutt