Why can ASP.NET place JavaScript in HTML comment blocks and not in CDATA?

We have an ASP.NET 2.0 WebForms application that uses MS Ajax 1.0. It works great in all of our environments (dev, test, IE6 VM, etc.). However, client-side verification does not occur on the client site.

We are currently trying to eliminate all the various factors, and along the way we asked them to get the source of their page and send it to us, and we found something interesting.

In our environment, our page has ASP.NET javascript in CDATA blocks:

<script type="text/javascript">
//<![CDATA[
. . .
//]]>
</script>

In its environment, the same code looks like this:

<script type="text/javascript">
<!--
. . .
//-->
</script>

It may be a red herring, but I would like to exclude it as the cause of the verification problems.

Does anyone know if specific configurations / patches / versions of ASP.NET will do this?

+3
3

, machine.config :

<xhtmlConformance mode="Transitional" />

"legacy".

+2

, , () XHTML. web.config xhtmlConformance. xhtml, HTML, xhtml.

+3

web.config JavaScript, , .

<xhtmlConformance mode="Transitional" />

What was the problem with the verification was installed on the server. NET 2.0 Server Pack 2. It seems that using s from the MS Ajax 1.0 library on .NET 2.0 can break your s if you do not install SP2.

+1
source

Source: https://habr.com/ru/post/1738059/


All Articles