Purpose of ActionName

后端 未结 6 1602
渐次进展
渐次进展 2020-11-27 03:37

What\'s the benefit of setting an alias for an action method using the \"ActionName\" attribute? I really don\'t see much benefit of it, in providing the user the option to

6条回答
  •  一向
    一向 (楼主)
    2020-11-27 03:45

    It is also useful if you have two Actions with the same signature that should have the same url.

    A simple example:

    public ActionResult SomeAction()
    {
        ...
    }
    
    [ActionName("SomeAction")]
    [HttpPost]
    public ActionResult SomeActionPost()
    {
        ...
    }
    

提交回复
热议问题