ASP .NET MVC NonAction meaning

后端 未结 10 1723
没有蜡笔的小新
没有蜡笔的小新 2021-01-03 17:39

Can anybody please tell me why should I use NonAction? I mean say I have a form with several submit values: Update, Delete or Insert. Since all the submit buttons have the s

10条回答
  •  无人及你
    2021-01-03 18:13

    You can omit the NonAction attribute but then the method is still invokable as action method.

    From the MSDN site (ref):

    By default, the MVC framework treats all public methods of a controller class as action methods. If your controller class contains a public method and you do not want it to be an action method, you must mark that method with the NonActionAttribute attribute.

提交回复
热议问题