Reputation: 7715
I want to reliably and easily Uri encode paths such as "/folder/foo%bar" to "/folder/foo%25bar".
I would have hoped that HttpUtility.UrlPathEncode
would do the trick but this method only escapes spaces. I don't want to url HttpUlity.UrlEncode
as this will encode "foo bar" to "foo+bar" - which ain't what I want.
Upvotes: 2
Views: 1123
Reputation: 1133
public static string CustomURLEncode(string str)
{
return System.Web.HttpUtility.UrlEncode( str ).Replace(”+”,”%20″);
}
Upvotes: 4