302 来自阿帕奇
我有一个 C# 应用程序来登录网站并收集一些数据。服务器 (Apache) 有时会发回 302 代码,随后 C# 应用程序会使用相同的 URI 再次向服务器发送请求。问题是 Apache 停止并显示“W”状态(HttpClient 卡在请求上)。 我想知道如果我发送带有response.ResponseURI的请求就可以解决这个问题,为什么服务器会以不稳定的方式发送代码302?有人告诉我,当请求的页面内容未更改时,Apache 会回答此代码 (302)。 ???
请帮帮我好吗?
I have a C# app to log on a website and collects some data. The server (Apache) sometimes sends back the 302 code whereupon the C# application sends a request again to the server with the same URI. The problem is the Apache stops with 'W' status (HttpClient stuck on request).
I would like to know if I send a request with the response.ResponseURI that it would be solve this problem, and why the server sends the code 302 so on erratic way? Someone said me the Apache answers this code (302) when the content of the requested page was not changed. ???
Help me, please?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
检查http://www.w3.org/Protocols/rfc2616/rfc2616-sec10。 html 。如果您有 302 代码响应,则应使用 HTTP 服务器响应的 Location: 标头指示的 URI 重做请求。
这是临时重定向。
重定向在响应 POST 请求时非常常见(为了完美,应该是 303 重定向...),并且肯定会重定向到已登录用户的主页 url,或者如果登录失败则重定向到登录表单。
Check http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html . If you have a 302 code response you should redo a request with the URI indicated by the Location: header of the HTTP server response.
This is a temporary redirect.
Redirect are quite common in response to POST requests (to be perfect it should be a 303 redirect...) and it's quite certainly done to redirect you to the home page url for logged in users OR to the login form if you failed your login.