Sharunas Bielskis Sharunas Bielskis - 23 days ago 7
C# Question

How to UrlEncode symbols ( and )

I use System.Net.WebUtility.UrlEncode(myString) to UrlEncode string and get encoded string in uppercase tags after encoding (I found solution .net UrlEncode - lowercase problem). But problem what left for me ar ( and ) encoding. In this case both symbols left uncoded when I need %28 and %29 code instead them. How to solve this problem?

Answer

I used this:

myString = myString.Replace("(", "%28").Replace(")", "%29");
Comments