我想使用路由将查询字符串添加到 url 的末尾。如何在 Global.asax 中执行此操作?
routes.MapRoute(
"Detail",
"{controller}/{action}/{id}/{name}",
new
{
action = "Detail",
name = UrlParameter.Optional,
// it is possible to add here query string(s) ?
},
new[] { "MyProject.Controllers" }
);
例如,实际的 url 包含:
www.mysite.com/MyController/Detail/4/MyValue
但我想生成类似的东西:
www.mysite.com/MyController/Detail/4/MyValue?ref=test&other=something