Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

System.Web.Mvc.HttpPostAttribute vs System.Web.Http.HttpPostAttribute? [duplicate]

In my Web API project which is based on the ASP.NET MVC, I want to use the HttpPost attribute. When I've added that onto the action, The IntelliSense suggests me these two namespaces:

  • System.Web.Mvc.HttpPostAttribute
  • System.Web.Http.HttpPostAttribute

Which one should be used and why?

like image 911
Ahmad Payan Avatar asked Aug 27 '17 08:08

Ahmad Payan


1 Answers

Prior to ASP.NET Core, MVC and WebAPI were mainly separate libraries.

The .Mvc namespace applies to MVC controllers, the .Http namespace to Web API controllers.

like image 121
CodeCaster Avatar answered Oct 11 '22 13:10

CodeCaster