本文介绍了ASP.NET 2.0/3.5中的XHTML 1.0严格(或过渡性)合规性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有任何好的方法可以使ASP.NET 2.0在XHTML 1.0严格(或过渡)DTD下进行验证?在了解HTTP响应的核心之前,我很想听听一些想法.

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.

一个主要问题是表单标签本身,这是我尝试验证时从W3C获得的输出:

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

众所周知,该标记对于ASP.NET非常重要.嗯.

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

推荐答案

ASP.NET 2.0及更高版本确实可以输出严格(或过渡)XHTML.除其他事项外,这将解决您的没有属性名称""验证错误.要进行此设置,请使用以下内容更新您的Web.config文件:

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>

对于过渡XHTML,请改用mode="Transitional".

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

请参见如何:在ASP.NET网站中配置XHTML呈现在MSDN上.

这篇关于ASP.NET 2.0/3.5中的XHTML 1.0严格(或过渡性)合规性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-06 20:05