Crystal Rouse
asked on
How to update Methods to use HttpPost instead of HttpPost to resolve security concerns.
I have some methods in Controllers that I need to update to use the action verb [HttpPost] instead of [HttpGet]. When I do this, the code in the View no longer works.
Here is an example:
The Controller has the following method:
[HttpGet]
public ActionResult MoveToReview(int id)
{
tbl_BOM bom = (from x in bomDB.tbl_BOM
where x.ID == id
select x).Single();
bom.SetStatus(tbl_Status.g etStatusID ("Review") );
return RedirectToAction("Details" , new { id = id });
}
The View uses this in a button:
<button class="btn btn-success col-xs-6 col-xs-offset-3" onclick="window.location = '@Url.Action("MoveToReview ", "Report", new { id = Model.id })';">
Move To Review
</button>
If I update to use [HttpPost], I get an error.
Here is an example:
The Controller has the following method:
[HttpGet]
public ActionResult MoveToReview(int id)
{
tbl_BOM bom = (from x in bomDB.tbl_BOM
where x.ID == id
select x).Single();
bom.SetStatus(tbl_Status.g
return RedirectToAction("Details"
}
The View uses this in a button:
<button class="btn btn-success col-xs-6 col-xs-offset-3" onclick="window.location = '@Url.Action("MoveToReview
Move To Review
</button>
If I update to use [HttpPost], I get an error.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.