RouteConfig.cs
我的asp.net mvc4 应用程序中的文件有问题:
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
routes.MapRoute(
name: "Admin",
url: "Admin",
defaults: new { controller = "Home", action = "Administration" }
);
}
在home
控制器中:
public class HomeController : Controller
{
public ActionResult Index()
{
return View();
}
public ActionResult Administration()
{
return View();
}
并添加了视图:
但是当我把http://localhost:61961/Admin
它作为 url 时,找不到视图。
为什么会发生这种情况?我该如何解决?