If you want to easily be able to add additional route value parameters to your Url.Action, try this extension method (based on Linefeed’s) which takes an anonymous object and returns a RouteValueCollection:
public static RouteValueDictionary ToRouteValues(this NameValueCollection col, Object obj)
{
var values = new RouteValueDictionary(obj);
if (col != null)
{
foreach (string key in col)
{
//values passed in object override those already in collection
if (key != null && !values.ContainsKey(key)) values[key] = col[key];
}
}
return values;
}
Then you can use it like so:
Url.Action("action", "controller", Request.QueryString.ToRouteValues(new{ id=0 }));