Quick tip for using XHTML Strict with ASP.net

One thing that has always infuriated me with .net is it’s insistence on adding an invalid name attribute to the asp.net form*.

About a month ago I found a nice easy cure for this, so I thought I’d share it. All you need to do to stop .net adding the name attribute to the form is add an xhtmlConformance tag to your web.config like so:

  1. <configuration>
  2. <system.web>
  3. <xhtmlConformance mode=“Strict” />
  4. </system.web>
  5. </configuration>

Hopefully that’ll be of some use to someone.

*What annoys me more is the fact you have to have a form tag on every page for .net to work, but that’s a rant for another day.