When you make a request for a file (or folder) from an IIS server, IIS first checks if the file exists - if not you get the 404 errors - if it does exist it checks the extension of the file requested, and if it's .aspx IIS hands the request off to the .Net engine.
So, in your case, since the file doesn't exist, the request is never given to the .Net processing engine - thus your code will never run. The way to get around this is to either 1) make sure the file/folder exists (even if it's basically empty) or 2) Have IIS not do any checking and just automatically give every request to .Net.
Are you on IIS 7 or 6?