我有这样一个简单的控制器(不,不是真的,但假设我有)
public class SomethingController : Controller {
public ActionResult Method1() {
return View("Something1");
}
public ActionResult Method2() {
return View("Something2");
}
}
现在我想将此控制器用于两种不同的路由:
public static void RegisterRoutes(RouteCollection routes) {
routes.MapRoute("Route 1", "Route1/{action}", new { controller = "Something" });
routes.MapRoute("Route 2", "Route2/{action}", new { controller = "Something" });
}
到现在为止,没什么特别的。然而,在我看来
Something1
Html.ActionLink("Do Something", "Method2")
这应该是
<a href="Route1/Method2"...
或
<a href="Route2/Method2"...