What is the difference between and ?

See also this question. MVC hasn’t changed how these bee-stings work, just how often they’re used.

Basically:

  • <% – execute code
  • <%@ – page directive
  • <%$ – resource access
  • <%= – explicit output to page
  • <%# – data binding
  • <%-- – server side comment block

Also new in ASP.Net 4:

  • <%: – writes out to the page, but with HTML encoded

Leave a Comment