What is use of [HttpPost] on ActionResult methods in MVC3? [Resolved]

Posted by Allemahesh under ASP.NET on 7/19/2013 | Points: 10 | Views : 2404 | Status : [Member] [MVP] | Replies : 1
I have seen [HttpPost] on ActionResult methods in MVC3. Whey we use this and what is purpose of this?
Can any one help me.

[HttpPost]
public ActionResult Create(FormCollection collection)
{
try
{
// TODO: Add insert logic here

return RedirectToAction("Index");
}
catch
{
return View();
}
}




Responses

Posted by: Emil on: 7/19/2013 [Member] Starter | Points: 50

Up
0
Down

Resolved
When we want to submit a form at that time we use [HttpPost] attribute
Inorder to get FormCollection value we use [HttpPost] attribute
By default it is [HttpGet] attribute

Allemahesh, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response