Reputation: 925
I saw MvcHtmlString in msdn but I have a question about Encoding.
What is exactly Encode ASP.Net MVC
and what is the difference between Encode and Decode Value?
Upvotes: 0
Views: 287
Reputation: 51624
Some characters must be encoded to ensure proper display. For instance <
and >
are special characters that tell the browser that the text between the two is an HTML tag and must be interpreted as part of the markup. To be able to display <
and >
as part of the text, it must be encoded. HTML encoding will substitute these with <
and >
respectively. The browser then knows it's not part of the markup and displays it accordingly.
Decoding is the other way around: <
becomes <
, &
becomes &
, etc.
Upvotes: 2