User:
Password:

Content Negotiation with ASP.NET and IIS

global.asax:
void Application_PreSendRequestHeaders(Object sender, EventArgs e) {
  // Taken from http://idunno.org/displayBlog.aspx/2005090201
  // Serve Content-Type "application/xhtml+xml" to browsers that accept it
  if (Array.IndexOf(Request.AcceptTypes, "application/xhtml+xml") > -1 &&
    Response.ContentType == "text/html" &&
    Response.StatusCode == 200 &&
    !Response.IsRequestBeingRedirected)
    Response.ContentType = "application/xhtml+xml";
}
Got IPv6?
Valid XHTML 1.0 Transitional! Valid CSS! Made with Cascading Style Sheets