Not getting custom 404 error page when url contains more than 3 "/" in mvc .net application

Below url works fine and redirects to the custom error page for page not found.

http://localhost:50298/a/b/c  

But when the Url is longer like the below one

http://localhost:50298/a/b/c/d

then it shows the default error page instead of showing the custom error page with message "HTTP Error 404.0 - Not Found The resource you are looking for has been removed, had its name changed, or is temporarily unavailable."

In the web.config below is added . It works fine for shorter url with max 3 "/" but it doesn't works when it is more than 3.

</system.web>
    <customErrors mode="On" defaultRedirect="~/Error/Index">
        <error statusCode="404" redirect="~/Error/NotFound"/>
    </customErrors>
</system.web>

Is there any setting required to be done to show the custom error page for longer urls instead of the default iis error page ?