Escape text for HTML November 30, 2022 by Tarik using System.Web; var encoded = HttpUtility.HtmlEncode(unencoded);