I’m having trouble finding the correct way to URL encode a string in C#. What I want is to encode the string some string to some%20code. Using HttpUtility.URLEncode(); method encode is to some+string.
I’m having trouble finding the correct way to URL encode a string in C#.
Share
HttpUtility.UrlEncodedoes the right thing here.When it comes to spaces on the URL, a
+or%20are both correct.Also see URL encoding the space character: + or %20?.