MVC2 JSON action, if I want to be RESTful should I allow GET, POST, or Both?

Posted by Yads on Stack Overflow See other posts from Stack Overflow or by Yads
Published on 2011-01-14T05:55:12Z Indexed on 2011/01/14 6:53 UTC
Read the original article Hit count: 150

Filed under:
|
|

The project I'm currently working has a whole bunch of JSON actions in order to populate cascading dropdowns via ajax calls. Since they're technically Select queries and we're trying to be RESTful, we've been marking these actions with the HttpGet attributes. However by default, JsonResultdoes not allow to return results via a GET. So we've had to explicitly call Json(data, JsonRequestBehavior.AllowGet).

What I'm wondering is, is this bad practice? Should we only be allowing Post requests to our Json actions? If it makes a difference, this is an enterprise application, that requires a log in to a particular environment before it can be accessed.

© Stack Overflow or respective owner

Related posts about asp.net-mvc

Related posts about JSON