使用线程延迟 HttpWebrequest
我使用代理并使用 HttpWebReuqest
访问一些网页。有时,代理会发送一条欢迎消息,表示 10 秒后我将被重定向到所需的页面。
当我已经收到回复时会发生这种情况。所以里面的内容:
HttpWebResponse urlResponse =(HttpWebResponse ) urlRequest.GetResponse();
Stream contentStream = urlResponse.GetResponseStream();
StreamReader sr = new StreamReader(contentStream, Encoding.GetEncoding("iso-8859-9"));
content = sr.ReadToEnd();
不是我要找的。
我尝试将allow autoredirect设置为true,但没有帮助,因为页面加载时没有任何重定向,但仍然等待10秒。
有办法解决这个问题吗?我怎样才能实现线程:
HttpWebResponse urlResponse =(HttpWebResponse )urlRequest.GetResponse();
谢谢。
I use a proxy and visit some webpages with HttpWebReuqest
. Sometimes a welcome message comes from the proxy and says I will be redirected to the desired page after 10 seconds.
This happens when I have already received the response. So the content inside:
HttpWebResponse urlResponse =(HttpWebResponse ) urlRequest.GetResponse();
Stream contentStream = urlResponse.GetResponseStream();
StreamReader sr = new StreamReader(contentStream, Encoding.GetEncoding("iso-8859-9"));
content = sr.ReadToEnd();
is not what I am looking for.
I tried setting allow autoredirect to true, but it didn't help, because the page is loaded without any redirect, but still waits 10 seconds.
Is there a way to fix this problem? How can I implement threading with:
HttpWebResponse urlResponse =(HttpWebResponse )urlRequest.GetResponse();
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
禁用代理服务器中的 10 秒等待或解析 HTML 输出以获取重定向 URL,此 URL 可能位于
HTTP 元刷新
或某些 JavaScript 中Either disable the 10 sec wait in your proxy server or parse the HTML output to get the redirect URL, this URL could be in
HTTP meta refresh
or in some JavaScript