Where does <customErrors> in web.config go for MVC applications?

In web.config file under root directory

<system.web>
<customErrors mode="On">
</customErrors>

Create a shared folder under view folder, and create a view under shared folder for showing Error message

in action use that [HandleError] like

[HandleError]
    public ActionResult Errors()
    {
        throw new Exception();
    }

<customErrors> goes inside <system.web>:

<configuration>
    <system.web>
        <customErrors mode="RemoteOnly">
            <error statusCode="500"
                   redirect="~/Error/InternalServer" />
            <error statusCode="404"
                   redirect="~/Error/NotFound" />
        </customErrors>
    </system.web>
</configuration>

Modify values of the redirect attributes according to your routes. You can also implement a catch-all redirect by adding a defaultRedirect attribute to the customErrors element. See this MSDN article for more information.