![](/img/trans.png)
[英]ASP.NET Core 2.2 MVC MapRoute project to ASP.NET 3.0 endpoints MapAreaControllerRoute "This localhost page can't be found"
[英]how to change area to seprate project by MapRoute in asp.net mvc
如何在asp.net mvc中通過MapRoute更改區域“ Admin”以分離項目
我正在使用代碼:
namespace App.Web
{
public class RouteConfig
{
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
var route = routes.MapRoute(
"Admin_default",
"Admin/{controller}/{action}/{id}",
new { controller = "Home", action = "Index", area = "Admin", id = "" },
new[] { "app.Admin.Controllers" }
);
route.DataTokens["area"] = "Admin";
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
}
}
}
但是當在瀏覽器中輸入URL時: http:// localhost:27824 / admin / home / index => show app.Web.Controllers-> home-> index !! (app.Admin.Controllers->主頁->索引不顯示!!)
您無法路由到其他項目。 路線是特定於項目的。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.