How to get MVC action to return 404
In ASP.NET MVC 3 and above you can return a HttpNotFoundResult from the controller.
return new HttpNotFoundResult("optional description");
There are multiple ways to do it,
- You are right in common aspx code it can be assigned in your specified way
throw new HttpException(404, "Some description");