Question is: Why is custom Error handling not working for non-existing paths/directories?
Updated with fixed code (thanks to everyone for you input):
ASP.NET is never being invoked by IIS. IIS handles the page request, sees that the page doesn't exist, and ASP.NET never gets loaded.
If you want ASP.NET to get loaded regardless of whether the file exists, you need to change your IIS configuration. Are you using IIS6 or IIS7/7.5?