C# Uri.EscapeDataString adds incorrect "%25" in the decoded string
c#, urlencode
Solution
Well, after searching around a bit more, it seems that this does the job, without relying on system web:
System.Net.WebUtility.UrlEncode(url);
The encoding is the correct one, without `%25`s.
Problem
I'm trying to UrlEncode a web address using Uri.EscapeDataString, but the result isn't correct. Here's an example: ``` string url = "https://mega.co.nz/#!GVZFwAbB!NzdN2jp7A_WmQBLC4RJrCX8SzixFIEo7oZZARaMAmXQ"; string encodedUrl = Uri.EscapeDataString(url); ``` Expected result would be: ``` https%3a%2f%2fmega.co.nz%2f%23!GVZFwAbB!NzdN2jp7A_WmQBLC4RJrCX8SzixFIEo7oZZARaMAmXQ ``` But the actual one is: ``` https%253a%252f%252fmega.co.nz%252f%2523%21GVZFwAbB%21NzdN2jp7A_WmQBLC4RJrCX8SzixFIEo7oZZARaMAmXQ ``` As you can see, there's a bunch of extra `%25`s that don't belong there. Isn't `%25` the encode for "`%`"? There are no `%`s in my original string... what's going on? EDIT: I can't use the `System.Web assembly` for this project, so unfortunately I can't use the `HttpUtility.UrlEncode()` method for this.