How to set XHTML 1.1 doctype in ASP.NET 4.0

The doctype directive occupies the second section in .aspx page or ASP.NET web forms and appears just after the page directive, described in the article How to use Page directive in ASP.NET 4.0

The directive indicates the type of markup, HTML, XHTML, etc., used in the web page. This directive is optional, but Visual Studio 2010 adds it automatically. This is important because:

– Depending on the type of markup you’re using, there may be certain tricks that aren’t allowed.

– It influenced how a browser interprets your web page. If you don’t include a doctype on your web page, Internet Explorer switches itself into a quirks mode. While IE is in this mode, certain information details are details are processed in inconsistent, nonstandard ways. For example If you have a web page that looks dramatically different in Internet Explorer than it does in Firefox, the basic reason may be a missing or invalid doctype.


if you want to use the slightly tweaked XHTML 1.1 standard (rather than XHTML 1.0), you need the following doctype:





XHTML 1.1 is mostly identical to XHTML 1.0 but streamlines a few more details and removes a few more legacy details. It doesn’t provide a transitional option.

ASP.NET server controls work equally well with any doctype. It’s up to you to choose the level of standards compliance and backward compatibility you want in your web pages. If you’re still in doubt, it’s best to start out with XHTML 1.0 transitional, because it eliminates the quirks in different browser versions without removing all the legacy features. If you’re ready to make a clean break with HTML, even if it means a bit more pain, consider switching to XHTML 1.0 strict or XHTML 1.1