asp.net - 固定 URL 的 ASP.Net MVC 路由
问题描述
我有区域BackOffice
、控制器BrandController
和动作Edit
。我想将以下 URL 路由到此操作:/BackOffice/Brand/Act/Manage
URL 是固定的,任何元素都不得更改。如何使用 MapRoute 做到这一点?
解决方案
在AreaRegistration
类中BackOffice
:
public override void RegisterArea(AreaRegistrationContext context)
{
context.MapRoute(
null,
"/BackOffice/Brand/Act/Manage",
new { controller = "Brand", action = "Edit" }
);
}
推荐阅读
- javascript - 注册时存储用户名仅在页面刷新后显示(Firebase)
- python - 如何提取括号和中间的文本?
- reverse-proxy - 在 grafana 密码恢复电子邮件上,如何在恢复 URL 上拥有自己的 HTTPS 域?
- php - 此代码计算我的 WP 帖子上的每一个视图。如何让它计算唯一视图(不包括页面刷新)
- android - Android:我可以有一个可浏览的服务吗?
- prolog - 每次访问从子句检索的值时都会调用 Prolog 子句
- python - List not callable in Python Tkinter Tic Tac Toe using lambda
- udp - 如何使用 CRC32 校验和查找 UDP 数据包的错误位?
- python - 每次遇到关键字后查找下一个单词
- python - 不可理解的随机变量输出