Results = Results.Replace("%", "%25")
Results = Results.Replace("<", "%3C")
Results = Results.Replace(">", "%3E")
Results = Results.Replace("#", "%23")
Results = Results.Replace("{", "%7B")
Results = Results.Replace("}", "%7D")
Results = Results.Replace("|", "%7C")
Results = Results.Replace("\", "%5C")
Results = Results.Replace("^", "%5E")
Results = Results.Replace("~", "%7E")
Results = Results.Replace("[", "%5B")
Results = Results.Replace("]", "%5D")
Results = Results.Replace("`", "%60")
Results = Results.Replace(";", "%3B")
Results = Results.Replace("/", "%2F")
Results = Results.Replace("?", "%3F")
Results = Results.Replace(":", "%3A")
Results = Results.Replace("@", "%40")
Results = Results.Replace("=", "%3D")
Results = Results.Replace("&", "%26")
Results = Results.Replace("$", "%24")
In .net core ver 2.1 ( late 2018 ) I was able to use the following:
System.Web.HttpUtility.UrlEncode(string_to_encode)
Another character that needs escaping is the apostrophe. Replace it with %27.
string url = Server.UrlEncode(value).Replace("'", "%27);
HttpUtility.UrlEncode() And Server.UrlEncode() do not replace this character along with a few others for backwards compatibility with other .Net Frameworks. See this microsoft article for details: