Wei*_*Wei 5 asp.net-mvc routes attributerouting asp.net-mvc-5
有谁知道如何从动作过滤器中的属性路由获取路由名称?
例如,我有一个控制器和属性路由,如下所示:
[HttpGet]
[CustomActionAttribute]
[Route("~/index", Name="IndexPage")]
public async Task<ActionResult> Index()
{
//Controller logic
}
Run Code Online (Sandbox Code Playgroud)
是否可以在CustomActionAttribute中获取路由名称?
public override void OnActionExecuting(ActionExecutingContext filterContext)
{
//Get the current route name here
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3782 次 |
| 最近记录: |