I'm developing an ASP.NET MVC 5 app with .NET Framework 4.5.1 and C#.
I want to redirect to home/index when an user tries to get access to a resource that doesn't exist.
Yes, there are a lot of questions about how to solve this problem. I read them, but their solutions don't work for me.
Now, I'm trying this on web.config
:
<system.webServer>
<httpErrors>
<remove statusCode="404" subStatusCode="-1" />
<error statusCode="404" path="~/Home/Index" responseMode="Redirect" />
</httpErrors>
</system.webServer>
But, when I try to access this URL, http://host01/Views/ConnectBatch/Create.cshtml, I get the default 404 page.
Maybe the problem is in path="~/Home/Index"
but I tried with path="~/"
and I get the same default 404 page.
Any idea?