I'd like to have a single action respond to both Gets as well as Posts. I tried the following
[HttpGet]
[HttpPost]
public ActionResult SignIn()
That didn't seem to work. Any suggestions ?
I'd like to have a single action respond to both Gets as well as Posts. I tried the following
[HttpGet]
[HttpPost]
public ActionResult SignIn()
That didn't seem to work. Any suggestions ?
[HttpGet]
public ActionResult SignIn()
{
}
[HttpPost]
public ActionResult SignIn(FormCollection form)
{
}
Actions respond to both GETs and POSTs by default, so you don't have to specify anything:
public ActionResult SignIn()
{
//how'd we get here?
string method = HttpContext.Request.HttpMethod;
return View();
}
Depending on your need you could still perform different logic depending on the HttpMethod by operating on the HttpContext.Request.HttpMethod value.