文字列のURLエンコード

System.Web.HttpUtilityを使う

using System.Web;
string origin = "あsdf<dsf>/df\"dsf<@.sdaf>あああああ";

Console.WriteLine(origin);
string encoded = HttpUtility.HtmlEncode(origin);
Console.WriteLine(encoded);

string decoded = HttpUtility.HtmlDecode(encoded);
Console.WriteLine(decoded);

Console.WriteLine(decoded.Equals(origin));
あsdf<dsf>/df"dsf<@.sdaf>あああああ
あsdf&lt;dsf&gt;/df&quot;dsf&lt;@.sdaf&gt;あああああ
あsdf<dsf>/df"dsf<@.sdaf>あああああ
True