Turn your ASP.NET pages into valid XHTML Strict pages

Many developers seem to find it difficult to get their ASP.NET pages rendering in a valid XHTML Strict fashion. The solution is just a quick MSDN lookup away. Only two steps are required.

One, declare the proper XHTML Strict DOCTYPE :

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

Two, edit your Web.Config file and the following to the System.Web section :

<xhtmlConformance mode="Strict"/>

ASP.NET will now adjust the HTML it outputs from controls and get rid of the infamous name attribute on the form tag.