I am trying to do a custom 404 page.
I added an ErrorController as follows
public class ErrorController : Controller
{
public ViewResult PageNotFound()
{
Response.StatusCode = 404;
return View();
}
}
Added a View folder Error in the following hierarchy: Views > Error > PageNotFound.cshtml - which has my custom 404 message.
In web.config file in the <system.web>
tag:
<customErrors mode="On" redirectMode="ResponseRewrite">
<error statusCode="404" redirect="~Views/Error/PageNotFound"/>
</customErrors>