HTML Encode a string in C# 28-12-2015 18:07:38 C# / Converters 0 Bookmark(s) 205 View(s) To prevent that HTML tags in a string are rendered by the browser, you have to espace them from to <b>. In C# this can be done with WebUtility.HtmlEncode(): using System.Net; string raw = "Test"; var htmlEncoded = WebUtility.HtmlEncode(raw);