XHTML incompatibility with < asp:Menu> component using content-type="application/xhtml+xml"
I´m using ASP.NET 4.0 and testing the ASP.NET XHTML compatibility with some components and have figured out that the server control < asp:Menu> doesn´t works properly with XHTML.
I want that the browser treat the page as XHTML and not as an HTML document (the default for html/text content-type). As only the latest browsers recognize this mode (IE only since version 9) I´m using content-type negotiation (see: http://msdn.microsoft.com/en-us/library/aa479043.aspx#aspnetusstan_topic8) to deal properly when the browser supports it or not.
void Application_PreSendRequestHeader开发者_开发知识库s(object sender, EventArgs e)
{
if (Array.IndexOf(Request.AcceptTypes, "application/xhtml+xml") > -1)
{
Response.ContentType = "application/xhtml+xml";
}
}
That said, my application behaves accordingly, with the exception of the < asp:Menu> component, that don´t render properly.
I see that the problem is in the javascript generated by a WebResource.axd used to deal with the menu component.
Someone have faced a problem like it and figured out some workaround?
Thanks in advance.
The problem itself was not resolved. To allow the site to be correctly rendered, I just continue to serve its pages as "html/text", removing the content-type negotiation.
精彩评论