ASP Response.Status 设置不正确

发布于 2024-10-13 21:07:26 字数 793 浏览 2 评论 0原文

我正在使用经典 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

最笨的告白 2024-10-20 21:07:26

好吧..我刚刚想通了!

不需要

Response.redirect ( "http://www.frickingnutz.com" )

The Location 标头行来完成该部分。哎哟!

OK..I just figured it out!

Didn't need the line

Response.redirect ( "http://www.frickingnutz.com" )

The Location header does that part. Doh!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文