The situation is that its not always possible to play with the web.config or have access to IIS, that being said I had to come up with a way to catch all 404s in a .NET application, for aspx page extensions its fairly easily and the web is full of ideas... but for non aspx extensions I did the following, looking for advice, is this a good way? are their scenarios where it might fail? does it measure well in performance? thanks for adviceAfter checking my web.sitemap links and make my rewrites, the else block contains the followingstring s = context.Server.MapPath(context.Request.AppRelativeCurrentExecutionFilePath);if (!System.IO.File.Exists(s)){    throw new HttpException(404, Page not found);}and of course, the rest is handled by the application error handlernotice that all css, js, jpegs and other file types go through this checkedit: two problems seem to be persistent with regular error catch, html and friendly urls, they never seem to fire 404s (guessing there other file types, depends on isapi filters)
Is this a good way to catch all 404s in .NET without playing with IIS configuration?
c#;asp.net