I'm using AntiXssEncoder.UrlEncode to encode values in query string parameters. Spaces are being encoded as %20, but I want to use a plus sign instead.
Is there a better way to do this than calling .Replace("%20", "+") on the resulting string?
I'm using AntiXssEncoder.UrlEncode to encode values in query string parameters. Spaces are being encoded as %20, but I want to use a plus sign instead.
Is there a better way to do this than calling .Replace("%20", "+") on the resulting string?
You can easily do this by creating your own HtmlHelper class.
Something as simple as this would suffice:
public static class CustomHtmlHelpers
{
public static string UrlEncode(string url)
{
return url.Replace(" ", "+");
}
}
And then just use it like this:
CustomHtmlHelpers.UrlEncode("bla bla bla");