ASP.NET/IIS: 404 for all file types

后端 未结 7 719
走了就别回头了
走了就别回头了 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:45

    1. You can setup wild card mapping in IIS (Application configuration/Mappings/Wildcard mappings/ - just set aspnet_isapi.dll as executable and uncheck the Verify that file exists box) that will route all incoming requests to your app - so you can control the behavior directly from it.

    2. You don't have to setup static page in your IIS application settings. Imho, you should be able to setup valid url (e.g. /error_handler.aspx) from your app that will be used as landing page in case of specific server error.

提交回复
热议问题