ASP.NET/IIS: 404 for all file types

后端 未结 7 721
走了就别回头了
走了就别回头了 2020-12-20 21:51

I set up 404 handler page in web.config, but it works ONLY when extension of URL is .aspx (or other which is handled by ASP.NET). I know I can setup static HTML page in webs

7条回答
  •  清酒与你
    2020-12-20 22:40

    For information:

    This is one of the several nice things that IIS7 brings - all pages are routed through the handler such that you can do custom 404s and - usefully - directory and file level security for any file (based on the same web.config stuff as for asp.net files prior to IIS7).

    So notionally "use II7" is an answer (will be "the" answer in time) - but of course its not a terribly practical one if you're not hosting/being hosted on W2k8 (or higher).

提交回复
热议问题