views:

53

answers:

2

In ASP.Net MVC, how can I check in a controller method, if it was called using post or get?

I am aware I can limit methods to being called only by post or by get - but how can I check for post/get in a method that allows both?

+2  A: 

You can check the Request.HttpMethod property.

Darin Dimitrov
+8  A: 
ControllerContext.HttpContext.Request.HttpMethod

or just

Request.HttpMethod

in Controller

LukLed