1. Common denominator:[HttpPost] and [Acceptverbs (Httpverbs.post)] are the only data that accepts Post requests.
2. Different points:
In MVC, if you want an action to respond to a POST request or respond to a GET request, what should we do?
First [HttpPost] and [HttpGet] are not simultaneously present on an action
But [Acceptverbs (Httpverbs.get | Httpverbs.post)] can
Correct wording:
[Acceptverbs (Httpverbs.get | Httpverbs.post)] or [Acceptverbs ("Post", "GET", "Options")]
Public ActionResult Index ()
{
........................
}
Error wording:
[HttpPost] [HttpGet]
Public ActionResult Index ()
{
........................
}
!!! Note:
The
http specification defines 8 possible request methods:
get retrieves a simple request to identify a resource in the URI
head As with the Get method, the server returns only the status line and header, Does not return the request document
post The server accepts requests that are written to data in the client output stream
put The server holds the request data as a request for the new content of the specified URI
delete Server Delete Request for named resource in URI
options Request for Request method information supported by the server
trace Web server feedback HTTP request and its header request
connect a method that has been documented but not currently implemented, reserved for tunneling
[HttpPost] and [Acceptverbs (httpverbs.post)] differences