I can't find the thread, the search is kind of broken for me. But there was a request to include non-matched parameters as query string variables. So if you had a route with {Controller"foo", Action="bar" id=1, page=2} and page was not a route parameter
then your url would be something like this http://localhost/foo/bar/1?page=2. Rob created a ticket for it, not sure what the status is, and I would assume the ticket would cover redirects as well as Action Links. As both would call into RouteCollection.GetUrl()
abombss
Member
575 Points
164 Posts
Re: RedirectToAction with querystring?
Jan 08, 2008 04:43 PM|LINK
I can't find the thread, the search is kind of broken for me. But there was a request to include non-matched parameters as query string variables. So if you had a route with {Controller"foo", Action="bar" id=1, page=2} and page was not a route parameter then your url would be something like this http://localhost/foo/bar/1?page=2. Rob created a ticket for it, not sure what the status is, and I would assume the ticket would cover redirects as well as Action Links. As both would call into RouteCollection.GetUrl()
A workaround for now is to call.
string url = RouteCollection.GetUrl(this.ControllerContext, {Action="bar", id=1});
HttpContext.Response.Redirect(url + "?page=2")