burktelefon
burktelefon

Reputation: 1018

Determine if ajax request is of type POST or GET in ASP.NET MVC3

For exception handling purposes I would like to know if an ajax request was made with POST or GET, but can't find out how to do it.

I got this far:

var request = filterContext.RequestContext.HttpContext.Request.GetType();

Am I on the right track at all?

Upvotes: 1

Views: 1251

Answers (2)

Darin Dimitrov
Darin Dimitrov

Reputation: 1038730

filterContext.RequestContext.HttpContext.Request.HttpMethod

Upvotes: 3

shahkalpesh
shahkalpesh

Reputation: 33476

Take a look at RequestType property to determine whether it was a GET or a POST.

Request.RequestType

Upvotes: 5

Related Questions