String TestString = "This is a <Test String>."; String EncodedString = Server.HtmlEncode(TestString);
If you can't use HtmlEncode then you can use Base64Encode Method<br />
Encode public static string Base64Encode(string plainText) { var plainTextBytes = System.Text.Encoding.UTF8.GetBytes(plainText); return System.Convert.ToBase64String(plainTextBytes); } Decode public static string Base64Decode(string base64EncodedData) { var base64EncodedBytes = System.Convert.FromBase64String(base64EncodedData); return System.Text.Encoding.UTF8.GetString(base64EncodedBytes); }
Server.HtmlEncode
System.Net.WebUtility.HtmlEncode
System.Web.HttpServerUtility.HtmlEncode
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)