Skip to main content

Posts

Showing posts from August, 2010

Asp.NET Strict XHTML - Form Name Attribute

Generated XHTML by the .NET environment can throw an error if creating strict XHTML 1.1 as defined by <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> The .NET environment adds the attribute "name" to the "Form" tag, which is not valid, strict XHTML 1.1 as shown in the screen shot below when validating against the W3C service. Screen shot of W3C Strict XHTML 1.1 validation error To remove this error, the .NET environment needs to be told to generate strict XHTML, as opposed to transitional XHTML or HTML or some other format. This can be done by adding "<xhtmlConformance mode="Strict"/>" to the web.config file within the system.web node e.g. <?xml version="1.0"?> <!--      Note: As an alternative to hand editing this file you can u