What is the difference between <% and <%:

I could not find anything through Google, I believe that the search terms are too many to process. VS online help only explains <%, which is only embedded code. No mention of <%:

EDIT: My book says the only difference is that <%: returns MvcHtmlString. Why do we need an extra character for <%: just to return something?

EDIT2: Example:

<% Html.RenderAction("xxx", "xxx"); %>

Nothing returns, so we should say <%, because it will be htmlencode? But what if I do something in .RenderAction (), which should also be htmlencoded? Or does it make no sense?

Thanks for any help! It really helps me understand asp.net.

+3
3

, Html. , .

+2

<%:, HtmlEncode, <%:% > . .Net 4.

EDIT: , MvcHtmlString HtmlEncoded.

PS: () HTML- , , , , XSS -/.

+3

Both are used to render text in the view, however when using <%: the text is automatically HTMLEncoded.

+2
source

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