I have an action that takes in a string that is used to retrieve some data. If this string results in no data being returned (maybe because it has been deleted), I want to r
None of the above examples worked for me until I added the middle line below:
public ActionResult FourOhFour() { Response.StatusCode = 404; Response.TrySkipIisCustomErrors = true; // this line made it work return View(); }