我的routeConfig.cs文件目前有:
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
我的家庭控制器中有一个动作响应:
/home/trackUser/123
如何修改我的路由配置,以便在以下位置调用相同的操作:
/trackUser.aspx?userId=123
答案 0 :(得分:0)
现在无法检查,但试试这个:
routes.MapRoute(
name: "TrackUserAspx",
url: "/trackUser.aspx?userId={id}",
defaults: new { controller = "Home", action = "trackUser", id = UrlParameter.Optional }
);
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);