Detect if action is a POST or GET method

The HttpMethod property on the HttpRequest object will get it for you. You can just use:

if (HttpContext.Current.Request.HttpMethod == "POST")
{
    // The action is a POST.
}

Or you can get the Request object straight off of the current controller. It’s just a property.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)