What are the differences in rendering in asp.mvc

What are the differences in statements for the rendering server code?

Operator: <%@ Operator: <%: Operator: <%= 
+6
model-view-controller asp.net-mvc
source share
2 answers

<%: html encodes the result <% = equals Response.Write <% @ is a preprocessor that makes fun

+1
source share

<%= just evaluates the expression and writes the result to the page output

<%: the same, but HTML encodes the output - unless the output implements IHtmlString

<%@ refers to special framework directives, for example. <% @Page for specifying page attributes such as homepage

<% is for code blocks that are statements, not expressions. They will not generate page output unless you explicitly call a function that writes to the output.

<%# refers to data binding expressions that are evaluated when web form management is a database binding. Therefore, they are rarely used in MVC.

+9
source share

All Articles