How is Html.Encode() used? What is its purpose, and how is it useful?
ASP.NET MVC2 -- How is Html.Encode() used?
783 Views Asked by DarkLightA At
2
How is Html.Encode() used? What is its purpose, and how is it useful?
It HTML encodes the passed it text - this escapes things to avoid certain types of attacks, such as XSS.
For example:
Will result in:
Being output to the page. This ensures that the script will not run.