I am trying to return a 404 status code with my custom error page. However, I keep getting 200 back since the page is really relevant as far as the browser and server can tell.
What I'm trying to do so far:
<customErrors mode="On" defaultRedirect="~/404" > <error statusCode="404" redirect="~/404"/> </customErrors>
Where 404 is the route to the controller and the page not found action.
I also tried to set the status code in my action.
public ActionResult PageNotFound(string locale) { Response.StatusCode = 404; return View(); }
But it finishes with the fact that page is displayed by default the server error (gray-ish with a red error message text)
Any ideas on how to get around this?
Inx51
source share