response.Addheader不再工作了

时间:2011-06-06 05:19:51

标签: iis-7 vbscript asp-classic

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

这是我的代码的一部分

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

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

IIS 7,vb脚本,经典asp

1 个答案:

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

相关问题