I do not think you can use RedirectToAction as you want. The problem is that it will always encode the URLs of your parameters.
I think you have to process the request yourself. My suggestion is to use Url.Action () to generate the base url, since it works the same as RedirectToAction, but returns a string. And then you have to generate a request. Please remember to use Url.Encode () for each of your query items.
I also have a suspicion that you will be able to accomplish what you need with a custom route. I am not an expert at this, but I saw something in the use of regular expressions in routes, and it could be something that is worth a look.
Edit: I came up with an easier way to do what you want. Instead of manually adding plus signs yourself, simply create the full correct URL using Url.Action (), and then replace all instances of% 20 with a plus sign. Then redo this URL. How:
string newUrl = Url.Action("Search", new { query = query }); string plussedUrl = newUrl.Replace("%20", "+"); return new RedirectResult(plussedUrl);
Austin thompson
source share