Server-Side Validation
noun
say it: “SER-ver SYDE val-ih-DAY-shun” /ˈsɜːrvər saɪd ˌvælɪˈdeɪʃən/
Checking a form's values on the server when the request arrives, before saving anything.
What is Server-Side Validation?
Server-Side Validation — Checking what a form sent once it reaches the server, before saving anything. Browsers can be bypassed and requests can be sent by hand, so this is the check you always need, even when the browser checked too.
[HttpPost]
public IActionResult Create(Product product)
{
if (!ModelState.IsValid) return View(product);
productDao.Add(product);
return RedirectToAction("Index");
}
In a sentence
- “Even with checks in the browser, server-side validation stops a hand-made request with a negative price.”
Level: Apprentice · More Web Development terms at this level
Updated