【问题标题】:Friendly 404 Error Page for HiddenSegmentsHiddenSegments 的友好 404 错误页面
【发布时间】:2014-02-17 16:00:49
【问题描述】:

使用 HiddenSegments IIS7 会阻止浏览 /bin 和 /app_data 等文件夹

在网站显示空白页面的那一刻,是否可以将其路由到我的标准 404 页面?

【问题讨论】:

    标签: asp.net iis-7 custom-errors


    【解决方案1】:

    当然可以。这是我经常使用的 web.config 文件:

    <?xml version="1.0" encoding="UTF-8"?>
    <configuration>
        <system.webServer>
            <httpErrors>
                <remove statusCode="403" subStatusCode="-1" />
                <remove statusCode="500" subStatusCode="-1" />
                <remove statusCode="404" subStatusCode="-1" />
                <error statusCode="404" subStatusCode="-1"
    prefixLanguageFilePath="" path="/errordocs/404.htm" responseMode="ExecuteURL" />
                <error statusCode="500" subStatusCode="-1"
    prefixLanguageFilePath="" path="/errordocs/500.htm" responseMode="ExecuteURL" />
                <error statusCode="403" subStatusCode="-1"
    prefixLanguageFilePath="" path="/errordocs/403.htm" responseMode="ExecuteURL" />
            </httpErrors>
        </system.webServer>
    </configuration>
    

    【讨论】:

      猜你喜欢
      • 2013-03-02
      • 1970-01-01
      • 2016-12-29
      • 2011-08-23
      • 1970-01-01
      • 2010-12-31
      • 1970-01-01
      • 2014-08-29
      • 1970-01-01
      相关资源
      最近更新 更多