【问题标题】:response.Addheader not working anymoreresponse.Addheader 不再工作
【发布时间】:2011-06-06 05:19:51
【问题描述】:

我有一个 404 错误页面,response.status 是 404 昨天 response.Addheader 工作正常,但今天它只显示一个空白页,如果我检查标题状态,它是 404。

这是我的代码的一部分

Response.Status="404 Not Found"
Response.AddHeader "Location", domain & "/page-not-found"

在相同的代码中 - 301 状态工作正常

IIS 7、vb 脚本、经典 asp

【问题讨论】:

  • 位置标头仅运行状态代码等于 3XX 等,并且与客户端相关。也许是因为缓存。

标签: iis-7 vbscript asp-classic


【解决方案1】:

您可以编辑您的 web.config 以在 404 上重定向到那里...

<configuration>
   <system.web>
      <customErrors defaultRedirect="/page-not-found"
                    mode="RemoteOnly">
         <error statusCode="404"
                redirect="/page-not-found"/>
      </customErrors>
   </system.web>
</configuration>

来源:Web.config custom errors

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-03-16
    • 2012-04-11
    • 2018-06-01
    • 2016-11-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多