HiddenSegments的友好404错误页面

时间:2014-02-17 16:00:49

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

使用HiddenSegments IIS7阻止浏览/ bin和/ app_data

等文件夹

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

1 个答案:

答案 0 :(得分: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>