hi,
Try by including below in your web.config file
<system.web>
<customErrors mode="On" defaultRedirect="~/error">
<error statusCode="404" redirect="~/404" />
</customErrors>
</system.web>
With this, include the below part too
<system.webServer>
<httpErrors errorMode="Custom" >
<remove statusCode="404" subStatusCode="-1"/>
<error statusCode="404" path="/404" responseMode="ExecuteURL" />
</httpErrors>
</system.webServer>
regards
sarva