我希望来自 localhost/Other_Data 的所有请求都移动到 localhost/Other_Data/index2?id_Mode=1&city="ddd" 但我不喜欢使用重定向我想使用路由可能对我有帮助...谢谢
public class SupperController: Controller
{
public virtual ActionResult Index()
{
...
}
}
public class Other_Data:SupperController
{
public ActionResult Index2(int Id_Mode, string city)
{
....
..
}
}
....
..
.
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
routes.MapRoute(
name: "Default1",
url: "Other_Data/",
defaults: new { controller = "Other_Data", action = "Index2", Id_Mode = 1, city="ddd"}
);