Skip to content

Instantly share code, notes, and snippets.

@digitalParkour
Created September 25, 2017 22:28
Show Gist options
  • Select an option

  • Save digitalParkour/687e960cc1286b9bf46162ed336212b3 to your computer and use it in GitHub Desktop.

Select an option

Save digitalParkour/687e960cc1286b9bf46162ed336212b3 to your computer and use it in GitHub Desktop.
[HttpGet]
public ActionResult FormA()
{
var model = _example.GetModel();
return PartialView(model);
}
[HttpPost]
[MultiformPostProtection] /* Verifies form token matches this action, Form A, otherwise returns FormA() */
[ValidateAntiForgeryToken]
public ActionResult FormA(ExampleModel model)
{
return Content("Form A - Submitted!");
}
[HttpGet]
public ActionResult FormB()
{
var model = _example.GetModel();
return PartialView(model);
}
[HttpPost]
[MultiformPostProtection] /* Verifies form token matches this action name, Form B, otherwise returns FormB() */
[ValidateAntiForgeryToken]
public ActionResult FormB(ExampleModel model)
{
return Content("Form B - Submitted!");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment