0

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?

1

1 Answer 1

2

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 &lt and &gt respectively. The browser then knows it's not part of the markup and displays it accordingly.

Decoding is the other way around: &lt becomes <, &amp becomes &, etc.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.