¿Cuál es la diferencia entre [AcceptVerbs(HttpVerbs.Post)] y [HttpPost]?
Puedo decorar una acción con [AcceptVerbs(HttpVerbs.Post)] / [AcceptVerbs (HttpVerbs.Get)]
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult Create(string title)
{
// Do Something...
}
O con los atributos[HttpPost]/[HttpGet]
[HttpPost]
public ActionResult Create(string title)
{
// Do Something...
}
¿Son diferentes?
68
2 answers
Nada. Una es sólo una abreviatura de la otra.
52
Author: Matthew Manela,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2010-10-02 00:41:25
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2010-10-02 00:41:25
[HttpPost]
es la abreviatura de [AcceptVerbs(HttpVerbs.Post)]
. La única diferencia es que no puedes usar [HttpGet, HttpPost]
(y similar) juntos en la misma acción. Si quieres que una acción responda tanto a GETs como a POSTs, debes usar [AcceptVerbs(HttpVerbs.Get | HttpVerbs.Post)]
.
172
Author: Rudresha Parameshappa,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2013-04-16 10:29:36
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2013-04-16 10:29:36