Any way to handle Put and Delete verbs in ASP.Net MVC?

just wondering if anyone knows of a really calm view / uninstallation of an asp.net mvc preview 5 implementation.

+3
source share
6 answers

Check out the mvccontrib project at http://www.mvccontrib.org . A backup implementation was added in the source code and it is updated to version 5. Check the source code here - http://mvccontrib.googlecode.com/svn/trunk/src/MVCContrib/SimplyRestful

+2
source

Rails "method" , , .
, , asp.net mvc, ?

+1
+1

, , Rails , . Rails POST, GET, PUT DELETE, , -, PUT, , . , .

0

I think the new AcceptVerbsAttribute attribute in preview 5 should be able to direct any type of request to the specified action. Marking a method like the one below in theory allows all verbs to be processed, but I did not explicitly check put or delete.

[AcceptVerbs("delete")]
public object DoDeleteAction()
0
source

With MVC Beta, you can now use the HttpVerbs enumeration.

here is an example ...

[AcceptVerbs(HttpVerbs.Get)]
public ActionResult Index()
{ ... }

[AcceptVerbs(HttpVerbs.Post)]
public ActionResult Update()
{ ... }

[AcceptVerbs(HttpVerbs.Delete)]
public ActionResult Delete()
{ ... }

you get the idea.

hth :)

0
source

Source: https://habr.com/ru/post/1696702/


All Articles