ASP Response.Status 设置不正确
我正在使用经典 ASP,需要重定向状态代码为 301 的 URL。这是我正在使用的代码:
response.clear
Response.Status="301 Moved Permanently"
Response.AddHeader "Location", "http://www.frickingnutz.com"
Response.redirect ( "http://www.frickingnutz.com" )
response.end
但是,当我使用众多“标头”检查站点之一时,我发现 IIS 返回 302状态代码:
HTTP/1.1 302 Object moved =>
Server => Microsoft-IIS/5.0
Date => Mon, 24 Jan 2011 14:20:08 GMT
X-Powered-By => ASP.NET
Location => http://www.frickingnutz.com
Connection => Keep-Alive
Content-Length => 148
Content-Type => text/html; Charset=UTF-8
Set-Cookie => ASPSESSIONIDACCTDCSS=NLPNLBHCFEBAPMPODJPMDNMB; path=/
Cache-control => private
事实上,我根本无法强制任何状态代码,我尝试了各种不同的状态代码作为测试,我所能得到的只是302。
我怀疑这是一些IIS设置,但找不到任何东西。
I'm using Classic ASP and need to redirect a URL with a status code of 301. Here is the code I am using:
response.clear
Response.Status="301 Moved Permanently"
Response.AddHeader "Location", "http://www.frickingnutz.com"
Response.redirect ( "http://www.frickingnutz.com" )
response.end
However, when I use one of the many 'header' checking sites, I discover that IIS is returning a 302 status code:
HTTP/1.1 302 Object moved =>
Server => Microsoft-IIS/5.0
Date => Mon, 24 Jan 2011 14:20:08 GMT
X-Powered-By => ASP.NET
Location => http://www.frickingnutz.com
Connection => Keep-Alive
Content-Length => 148
Content-Type => text/html; Charset=UTF-8
Set-Cookie => ASPSESSIONIDACCTDCSS=NLPNLBHCFEBAPMPODJPMDNMB; path=/
Cache-control => private
In fact I can't force any status code at all, I tried various different ones as a test, and all I can get is the 302.
I suspect it is some IIS setting but couldn't find anything.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好吧..我刚刚想通了!
不需要
The Location 标头行来完成该部分。哎哟!
OK..I just figured it out!
Didn't need the line
The Location header does that part. Doh!