<p>Where can I setup custom errors for directories in my application such as App_Code, App_Browsers, etc.?  I already have customErrors configured in the web.config and that works as expected.  For example,</p>

<p><a href="http://www.mysite.com/bla.aspx" rel="nofollow noreferrer">http://www.mysite.com/bla.aspx</a> > redirects to 404 page</p>

<p>but</p>

<p><a href="http://www.mysite.com/App_Code/" rel="nofollow noreferrer">http://www.mysite.com/App_Code/</a> > displays "The system cannot find the file specified."</p>

<p>There's no physical App_Code directory for my site.  Is this something that I can change in IIS?</p>

One way is to provide a redirect in the global.asax file:
```
```
void Application_Error(object sender, EventArgs e) 
{
    //uncomment this to narrow down 'helpful' microsoft messages
    //HttpRequest request = ((HttpApplication)sender).Context.Request; 

    Exception ex = Server.GetLastError();
    //ErrorManager is a custom error handling module
    ErrorManager.ProcessError(ex);
    Response.Redirect("~/error.aspx?error=" + HttpUtility.UrlEncode(ex.Message), true);
}
```
```
{ On a side note, I was getting an exception that I just couldn't track down - it just said 'file not found' but didn't say which file was missing. It turned out to be a broken image reference in a css file - breaking on line two of the code above helped identify the missing file }