HtmlEncode and HtmlDecode

Skip Navigation LinksIrocon > Blog > 2005 > November, 2005 > November 05, 2005 > HtmlEncode and HtmlDecode

HtmlEncode and HtmlDecode

Very handy functions for making user input safe.

1) Add ValidateRequest="false" to the page declaration of your asp.net page
2) Encode the input before saving it by using HttpUtility.HtmlEncode
3) On the page that has to display the content, use HttpUtility.HtmlDecode

Last Updated:Thursday, September 02, 2010By:alfero#

Would you like to comment?

Sign in with your OpenID. If you do not know what OpenID is, find out.