3. Backend and frontend validation

MVC · Data Annotations · tag helpers emit data-val-* · jquery.validate.unobtrusive in the browser

Bypass the UI with curl

You can bypass the browser UI. The request below sends intentionally invalid data (name too short, not an email, age 5).

Expected: FAILS on the server — UI validation bypassed, but ModelState still catches it. Search the HTML for error messages.

Windows (cmd / PowerShell)
curl -k -L -sS -c cookies.txt -b cookies.txt -w "\n\nHTTP %{http_code}\n" -H "Content-Type: application/x-www-form-urlencoded" -d "Name=x&Email=not-an-email&Age=5" "https://app17i872272.luna.fhict.nl/Demo/Both"
Linux / macOS
curl -k -L -sS -c cookies.txt -b cookies.txt -w '\n\nHTTP %{http_code}\n' -H 'Content-Type: application/x-www-form-urlencoded' -d 'Name=x&Email=not-an-email&Age=5' 'https://app17i872272.luna.fhict.nl/Demo/Both'

-k ignores the local dev certificate. No -X POST (breaks redirects). -c/-b keeps cookies across redirects. Antiforgery is disabled for these demos.

Filter the HTML (use /C: for an exact phrase — a plain space means OR in findstr): … | findstr /i /C:"Registration received" or … | findstr /i /C:"field-validation-error"