HTML coded expressions

In ASP.NET 4.0

should use new syntax <%: expression %>or 2.0<%= HttpUtility.HtmlEncode(expression) %>

+3
source share
2 answers

Less keystrokes, less likely to make a mistake, easier to read => use the first option.

+1
source

A similar question if you want to do this:

<%= DateTime.Now %>

or

<% Response.Write(DateTime.Now) %>

There is no right answer, but, of course, it seems to me better.

0
source

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


All Articles