【发布时间】:2019-01-12 03:07:12
【问题描述】:
我想在 RedirectToAction 之后喜欢这个 (/User/Index?abc) url
怎么做请给我建议..
RouteConfig.cs
routes.MapRoute(
name: "Putabc",
url: "{tempUrl}/{RegNo}",
defaults: new { controller = "User", action = "Index", RegNo = UrlParameter.Optional}
);
控制器:-
public ActionResult Putabc()
{
string RegNo = "abc";
string tempUrl = Url.Action("Index", "User");
return RedirectToAction(new { url = tempUrl + "?{RegNo}" }, JsonRequestBehavior.AllowGet);
}
【问题讨论】:
标签: c# asp.net-mvc-4 routes