views:

37

answers:

2

In ASP.NET 4.0

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

+1  A: 

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

Spencer Ruport
A: 

That's sort of like asking if you should do this:

<%= DateTime.Now %>

or this

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

There's no right answer, but one certainly looks better to me.

John Sheehan