ASP.NET aspxerrorpath in URL

后端 未结 2 2014
遇见更好的自我
遇见更好的自我 2021-01-07 23:27

I have a site where I use CustomErrors in the web.config to specify a custom error page, and that\'s working just fine. The custom 404 page is also specified in the IIS con

相关标签:
2条回答
  • 2021-01-07 23:32

    You may have to add the below to web.config

    <customErrors mode="On">
      <error statusCode="404" redirect="~/error404.aspx" />
    </customErrors>
    

    For more information check : http://geekswithblogs.net/shahed/archive/2007/10/23/116278.aspx

    Update: We can utilize the IIS7 functionality for displaying custom 404 error pages using HTTPModules as described in http://professionalaspnet.com/archive/2008/02/13/Enforcing-a-Custom-404-Page-in-ASP.NET.aspx

    0 讨论(0)
  • 2021-01-07 23:42

    The aspxerrorpath parameter is passed if the error was caught by .NET (and the error page specified in web.config is used). This happens if you're using the development web server, or if IIS is configured not to check that the file exists.

    If IIS checks that the file exists, then the custom error configured in IIS is used, and the requested URL is included in the querystring as something like

    http://example.com/FileNotFound.aspx?404;http://example.com/badpage.aspx

    0 讨论(0)
提交回复
热议问题