Thursday, 15 September 2011

asp.net mvc - Can I pass data directly from GET to POST serverside for Create() methods in MVC4 Controllers? -



asp.net mvc - Can I pass data directly from GET to POST serverside for Create() methods in MVC4 Controllers? -

based on question: creating kid object in mvc4 - parent's info not beingness passed create() controller

does mvc provide mechanism send info httpget create() httppost create() without going through client? if need send info post method meaningless client, how can avoid cluttering views , over-exposing model properties potential attackers?

your , post actions methods on class. doesn't sound there's reason utilize post here, if concern execute block of code under conditions.

change post (drop attribute) , create private method inaccessible client. in get, whatever checks need do, invoke method.

if do need expose post, refactor code in question out seperate private method can phone call either or post. improve implementation separate class method located there reuse/testing/soc.

just caution if are working db here...while there legitimate reasons write db during get, note not indempotent nature of in circumstances (http://www.w3.org/protocols/rfc2616/rfc2616-sec9.html).

cheers.

asp.net-mvc asp.net-mvc-3 asp.net-mvc-4

No comments:

Post a Comment