【问题标题】:Custom 404 not found page in iis 7 for Classic ASP在经典 ASP 的 iis 7 中找不到自定义 404 页面
【发布时间】:2011-02-24 20:45:17
【问题描述】:

我安装了 windows 2008 服务器集成 iis 7.0

1 天前,我使用的是 windows 2003 和 iis 6.0

使用 windows 2008 服务器,一切都很好,除了一件事。

在 2003-iis6 中,我可以使用自定义 404 页面来处理对 url 友好的网站。 例如,我可以将 custom404.asp 设置为自定义 404 页面(执行 url)

2008 年,我做不到。 当我将自定义 404 页面设置为 /custom404.asp 时,没有任何反应。 在自定义错误页面中,它说这是针​​对 asp.net

我该怎么做?

【问题讨论】:

    标签: iis-7 asp-classic custom-error-pages


    【解决方案1】:

    下面的 webconfig 文件解决了这个问题。 我分享以防有人需要

    将代码另存为 web.config 并将其移动到主站点文件夹

    <?xml version="1.0" encoding="UTF-8"?>
    <configuration>
        <system.webServer>
            <httpErrors>
                <remove statusCode="404" subStatusCode="-1" />
                <error statusCode="404" subStatusCode="-1" prefixLanguageFilePath="" path="/default.asp" responseMode="ExecuteURL" />
            </httpErrors>
         <rewrite>
            <rules>
                <rule name="MyURLCleaned" enabled="false" stopProcessing="true">
                    <match url="^([^])+" />
                    <conditions>
                        <add input="{REQUEST_FILENAME}" />
    
                    </conditions>
                    <action type="Rewrite" url="/default.asp?{R:0}" />
                </rule>
            </rules>
                <rewriteMaps>
                    <rewriteMap name="static">
                    </rewriteMap>
                </rewriteMaps>
        </rewrite>
    
        </system.webServer>
    </configuration>
    

    【讨论】:

    • 修复了哪一部分? Anthony 描述的解决方案将根据 部分修改 Web.config。但话又说回来,你有这个重写规则的东西,这是 IIS 7 的新内容,所以我想知道你的重写规则是否可能导致这种情况。
    【解决方案2】:

    在 IIS 管理器的“错误页面”部分,选择“操作”部分下的“编辑功能设置...”。确保选择了“自定义错误页面”。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-01-31
      • 1970-01-01
      • 2011-02-24
      • 2010-12-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多