默认情况下,ASP.NET MVC引擎在以下文件夹中搜索View页面:
但是我想把我的一些View页面放在这样:
我怎样才能让发动机看起来如此?
我的区域在下面.仅突出显示相关部分.

路线表
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
"SubFolder", // Route name
"SubFolder/ChildController",
new { controller = "ChildController", action = "Index" },
new[] { "Practise.Areas.SOProblems.Controllers.SubFolder" });
routes.MapRoute(
"Default", // Route name
"{controller}/{action}", // URL with parameters
new { controller = "Home", action = "Index" } // Parameter defaults
);
}
Run Code Online (Sandbox Code Playgroud)
这只适用于url是这样的
localhost:2474/SOProblems/ChildController/index
Run Code Online (Sandbox Code Playgroud)
当url是这样时,这不起作用
localhost:2474/SOProblems/SubFolder/ChildController/index
Run Code Online (Sandbox Code Playgroud)
你能告诉我缺少什么吗?
在我的Controllers文件夹中,我想要一个名为Admin的子文件夹.
当我去http:// localhost:port/Admin/Login /它说无法找到页面.
RouteConfig.cs
using System.Web.Mvc;
using System.Web.Routing;
namespace ICT4Events
{
public class RouteConfig
{
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 }
);
}
}
}
Run Code Online (Sandbox Code Playgroud)