web.config not forwarding to 404 error page on non .aspx pages

后端 未结 2 605
栀梦
栀梦 2021-01-17 12:52

Objective

I want all URLs of missing pages to forward to my 404 page which is in my root as 404error.aspx

Problem

So far only the UR

2条回答
  •  情深已故
    2021-01-17 13:33

    The settings in the example customErrors section cause any unhandled HTTP 404 (file not found) errors to be directed to the Http404ErrorPage.aspx file. These HTTP 404 errors would occur if a request were made for an .aspx file, .asmx file, and so on and if the requested file did not exist. All other unhandled errors in ASP.NET files are directed to the DefaultRedirectErrorPage.aspx file.

    
      
      
      
        
    
        
        
          
        
    
      
    
    

    NoteNote: In the example, the mode attribute is set to "On" so that you can error messages when you run the example in Visual Studio. In a production environment, this setting would normally be "RemoteOnly". ASP.NET then renders error pages to external users. If a request is made on the server computer (localhost), ASP.NET renders a page with detailed error information.

提交回复
热议问题