I ask a similar question here, I need to keep current URL and add new parameter to it, the only answer (yet) is :
RouteValueDictionary rt = new RouteValueDictionary();
foreach(string item in Request.QueryString.AllKeys)
rt.Add(item, Request.QueryString.GetValues(item).FirstOrDefault());
rt.Add("RC", RowCount);
return RedirectToAction("Index", rt);
So is there any other way to avoid of repetition over Request.QueryString
and just get current url and add new parameter?
you don't need to iterate the collection... you could simply append your parameters to the request's RawUrl: