SyntaxFix
Write A Post
Hire A Developer
Questions
In case you're using SharePoint 2010, using the following line of code will avoid having to reference the whole System.Web library:
Microsoft.SharePoint.Utilities.SPHttpUtility.HtmlEncode(stringToEncode);