Post-Redirect-Get
noun
say it: “POHST ree-dih-REKT GET” /poʊst ˌriːdɪˈrɛkt ɡɛt/
Answering a form's POST with a redirect to a GET page, so refreshing the page does not send the form again.
What is Post-Redirect-Get?
Post-Redirect-Get — After a form's POST saves its data, answer with a redirect to a GET page instead of a page of your own. The browser's last request is then the GET, so pressing Refresh shows the page again instead of saving the order twice.
[HttpPost]
public IActionResult Create(Product product)
{
productDao.Add(product);
return RedirectToAction("Index"); // the browser now GETs /Products
}
In a sentence
- “After saving the order we use Post-Redirect-Get, so pressing Refresh can't place it twice.”
Level: Journeyman · More Web Development terms at this level
Updated