ASP.NET MVC & C# : HttpStatusCodeResult() vs HttpNotFound()

patsy2k

In ASP.NET MVC, what is the difference between returning this:

 return new HttpStatusCodeResult(HttpStatusCode.NotFound);

and this:

 return HttpNotFound();
silkfire

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.

edited at
0

Comments

0 comments
Login to comment

Related