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

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


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.