开发者

response.Addheader not working anymore

开发者 https://www.devze.com 2023-03-11 11:33 出处:网络
i have a page for 404 error and the response.status is 404 yesterday the response.Addheader was working fine but today it is just showing a blank page and if i check the header status it is 404.

i have a page for 404 error and the response.status is 404 yesterday the response.Addheader was working fine but today it is just showing a blank page and if i check the header status it is 404.

here is part of my code

Response.Status="404 Not Found"
Response.AddHeader "Location", doma开发者_如何学运维in & "/page-not-found"

in the same code - the 301 status works fine

IIS 7, vb script, classic asp


You could edit your web.config to redirect to there on 404...

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

Source:Web.config custom errors

0

精彩评论

暂无评论...
验证码 换一张
取 消