W3C validation of ASP.Net output

Why is my markup not valid?

A while ago I had to make certain that a CMS driven site built in .Net met some validation criteria.  Specifically the XHTML markup.  Running it by the W3C validator service, the markup always failed.

I fixed the obvious within the web.config.  For example, the following is needed to force the application to render XHTML:

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

If I painfully cut and pasted the HTML into the Validator’s form field, it passed.  The problem is, is that the service is not recognised by the Web server, and so a helper file in the application is required.