There are two simple ways to hadle errors in ASP Net, one is using global.asax file and another one is using web.config file. Following lines are to handle the custom errors for a asp net based webapplication,
<error statusCode="500" redirect="servererror.aspx" />
<error statusCode="404" redirect="filenotfound.aspx" />
<error statusCode="403" redirect="AccessDenied.aspx" />
</customErrors>
here 404 is for file not found error redirection.This works for whole application that means whether you are in asp page or html page it will
be redirected to error page.
