开发者

ASP.NET <%= %> vs <%: %>

开发者 https://www.devze.com 2023-01-21 17:42 出处:网络
It seems I am missing something.But ever since .Net 4.0 came out I have been seeing reference to <%: %> syntax for ASP.NET.It seems like it is similar to <%= %>but clearly there is a reaso

It seems I am missing something. But ever since .Net 4.0 came out I have been seeing reference to <%: %> syntax for ASP.NET. It seems like it is similar to <%= %> but clearly there is a reason for the new syntax. I tried google but searching <%: %> doesn't seem to return anything. What does the <%: %> syntax do? Was it introduced in .Net 4.0 or 3.5? Can someone enlighten me?

Edited: Please provide referenc开发者_运维知识库e or examples


i believe the <%: %> is auto HtmlEncoding

this post from Scott Gu will help to explain - it was introduced in .net 4 and MVC2

http://weblogs.asp.net/scottgu/archive/2010/04/06/new-lt-gt-syntax-for-html-encoding-output-in-asp-net-4-and-asp-net-mvc-2.aspx


: does html encoding.

Scott Guthrie has a nice post describing it in detail.

Don't use this where it is already encoded otherwise it will double encoded it. This is useful if you want to output things like HTML, though.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号