首页 > 解决方案 > 固定 URL 的 ASP.Net MVC 路由

问题描述

我有区域BackOffice、控制器BrandController和动作Edit。我想将以下 URL 路由到此操作:/BackOffice/Brand/Act/Manage

URL 是固定的,任何元素都不得更改。如何使用 MapRoute 做到这一点?

标签: asp.netrouting

解决方案


AreaRegistration类中BackOffice

public override void RegisterArea(AreaRegistrationContext context) 
{
    context.MapRoute(
        null,
        "/BackOffice/Brand/Act/Manage",
        new { controller = "Brand", action = "Edit" }
    );
}

推荐阅读