Reputation: 146
I added these codes inside my system.web tag in web config
<customErrors mode="On" defaultRedirect="Error/Index">
<error statusCode="404"
redirect="Error/Index/404" />
<error statusCode="403"
redirect="Error/Index/403" />
</customErrors>
Redirect is working when i type localhost/controllername/actioname
but when i type localhost/a/a/a/a/a/a/a/a
it displays an IIS 404 not found page.
Is there any other settings for this? thanks
Upvotes: 0
Views: 920
Reputation: 146
<httpErrors errorMode="Custom" existingResponse="Replace">
<remove statusCode="404"/>
<error statusCode="404" responseMode="ExecuteURL" path="/Error/404"/>
</httpErrors>
http://benfoster.io/blog/aspnet-mvc-custom-error-pages
MVC 5 HttpErrors + Controller/Action
Upvotes: 1