In ASP.NET MVC, what is the difference between returning this:
return new HttpStatusCodeResult(HttpStatusCode.NotFound);
and this:
return HttpNotFound();
The difference is that HttpStatusCodeResult
gives you more control over which HTTP status code you can return as it allows you to specify any of the predefined status codes in the HttpStatusCode
enum. HttpNotFound
always returns the HTTP status code 404.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments