Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

XHTML 1.0 Strict (or Transitional) compliance in ASP.NET 2.0/3.5

Are there any good methods for getting ASP.NET 2.0 to validate under the XHTML 1.0 Strict (or Transitional) DTD? I'm interested to hear some ideas before I hack up the core of the HTTP response.

One major problem is the form tag itself, this is the output I got from W3C when I tried to validate:

Line 13, Column 11: there is no attribute "name".
<form name="aspnetForm" method="post" action="Default.aspx" onsubmit="javascript

That tag is very fundamental to ASP.NET, as you all know. Hmmmm.

like image 900
craigmoliver Avatar asked Sep 30 '08 23:09

craigmoliver


1 Answers

ASP.NET 2.0 and above can indeed output Strict (or Transitional) XHTML. This will resolve your 'there is no attribute "name"' validation error, amongst other things. To set this up, update your Web.config file with something like:

<system.web>
    ... other configuration goes here ...
    <xhtmlConformance mode="Strict" />
</system.web>

For Transitional XHTML, use mode="Transitional" instead.

See How to: Configure XHTML Rendering in ASP.NET Web Sites on MSDN.

like image 75
Calroth Avatar answered Oct 20 '22 19:10

Calroth