My page load action result and http post action result both pass in the model.
[Authorize]
public ActionResult StepTwo(PostcodesModel model)
{
return View();
}
[Authorize]
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult StepTwo(PostcodesModel model)
{
return View();
}
Since they both take in the model, what can I add to make them unique ?
You should use ActionName attribute, it represents an attribute that is used for the name of an action. If it is not present the name of the method is used.
[Authorize]
public ActionResult StepTwo(PostcodesModel model)
{
return View();
}
[ActionName("StepTwo")]
[Authorize]
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult StepTwoPost(PostcodesModel model)
{
return View();
}
I usually use FormCollection:
[Authorize]
public ActionResult StepTwo(PostcodesModel model)
{
return View();
}
[Authorize]
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult StepTwo(PostcodesModel model, FormCollection additionalData)
{
return View();
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With