C# 代码

C# code?
1
2
3
4
5
6
7
8
9
String url="http://www.google.com.hk/search?hl=zh-CN&q=孟宪会";
System.Net.HttpWebRequest r = (System.Net.HttpWebRequest)System.Net.HttpWebRequest.Create(url);
r.AllowAutoRedirect = true;
//System.Net.CookieContainer c = new System.Net.CookieContainer();
//r.CookieContainer = c;
System.Net.HttpWebResponse res = r.GetResponse() as System.Net.HttpWebResponse;
System.IO.StreamReader s = new System.IO.StreamReader(res.GetResponseStream(),System.Text.Encoding.GetEncoding("GB2312"));
Response.Write(s.ReadToEnd());
res.Close();

解决方法就是加上CookieContainer,完整的代码:
C# 代码

C# code?
1
2
3
4
5
6
7
8
9
String url="http://www.google.com.hk/search?hl=zh-CN&q=孟宪会";
System.Net.HttpWebRequest r = (System.Net.HttpWebRequest)System.Net.HttpWebRequest.Create(url);
r.AllowAutoRedirect = true;
System.Net.CookieContainer c = new System.Net.CookieContainer();
r.CookieContainer = c;
System.Net.HttpWebResponse res = r.GetResponse() as System.Net.HttpWebResponse;
System.IO.StreamReader s = new System.IO.StreamReader(res.GetResponseStream(),System.Text.Encoding.GetEncoding("GB2312"));
Response.Write(s.ReadToEnd());
res.Close();

“重定向次数过多”或者“Too many automatic redirections were attempted”的错误:的更多相关文章

  1. too many automatic redirections were attempted

    用HttpClient时发现一下页面跳转现象. 页面A要求授权自动跳转到页面B, 页面B进行了授权,在HTTP Header里要求SetCookie并跳转到页面A. 再次请求页面A的时候没有带上此Co ...

  2. [学习笔记]agileone安装登陆报错,localhost重定向次数过多

    1.找到.htaccess文件 2.修改RewriteEngine  参数为off即可

  3. python爬虫重定向次数过多问题

    错误提示如下: raise TooManyRedirects('Exceeded %s redirects.' % self.max_redirects, response=resp)requests ...

  4. Java 使用拦截器无限转发/重定向无限循环/重定向次数过多报错(StackOverflowError) 解决方案

    说明:当使用拦截器出现"请求转发"无限循环或者"重定向"次数过多这种问题的时候,一般都是 拦截器 设置错了 情况一:请求转发时没有配置排除拦截路径,就是说你访问 ...

  5. localhost 将您重定向的次数过多

    localhost 将您重定向的次数过多 问题描述:在项目中,出现 localhost 将您重定向的次数过多 ,有可能是因为设置重定向的时候,自己重定向到自己,或者重定向成环,导致无限的重定向.检查重 ...

  6. 系统运行缓慢,CPU 100%,以及Full GC次数过多问题的排查思路

    前言 处理过线上问题的同学基本上都会遇到系统突然运行缓慢,CPU 100%,以及Full GC次数过多的问题.当然,这些问题的最终导致的直观现象就是系统运行缓慢,并且有大量的报警. 本文主要针对系统运 ...

  7. DiscuzX2.5密码错误次数过多,请 15 分钟后重新登录的修改办法

    source\function function_login.php $return = (!$login || (TIMESTAMP - $login['lastupdate'] > )) ? ...

  8. 性能测试 | 系统运行缓慢,CPU 100%,Full GC次数过多问题排查

    处理过线上问题的同学基本上都会遇到系统突然运行缓慢,CPU 100%,以及Full GC次数过多的问题.当然,这些问题的最终导致的直观现象就是系统运行缓慢,并且有大量的报警.本文主要针对系统运行缓慢这 ...

  9. 换系统之后为什么iMindMap会提示“许可证使用的次数过多”

    iMindMap是一款十分受欢迎的思维导图软件,随着12版本的上线,iMindMap新增了很多新用户,最近小编发现有不少新用户在群里反映:"为什么购买iMindMap时说可以支持换机,但是在 ...

随机推荐

  1. [Postgres] Filter Data in a Postgres Table with Query Statements

    We have all this data, but how do we answer questions about it? In this lesson we’ll learn how to fi ...

  2. 微信小程序从零开始开发步骤(一)

    从零到有写一个小程序系列专题,很早以前就想写来分享,但由于项目一直在进展,没有过多的时间研究技术,现在可以继续分享了.1:注册用没有注册过微信公众平台的邮箱注册一个微信公众号, 申请帐号 ,点击 ht ...

  3. Python将被加入高考科目?你怎么看?

    今天看到这样的一则新闻:不禁感叹,人工智能这股风来的太快,已经掀起全民学习Python的浪潮. 2017年中观察:看上去这个大纲内容基本是这样了,但是实行年份可能要往后推了,不在2017年执行了(据说 ...

  4. PatentTips - Heterogeneous Parallel Primitives Programming Model

    BACKGROUND 1. Field of the Invention The present invention relates generally to a programming model ...

  5. 流媒体协议介绍(rtp/rtcp/rtsp/rtmp/mms/hls

    http://blog.csdn.net/tttyd/article/details/12032357 RTP           参考文档 RFC3550/RFC3551 Real-time Tra ...

  6. 基于webRTC技术 音频和视频,IM解

    由于原来的文章 http://blog.csdn.net/voipmaker  转载注明出处. 基于WebRTC技术可实现点对点音视频.即时通信.视频会议.最新的系统组件包含: TeleICE NAT ...

  7. C++ Primer章课后编程问题

    watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvZ3V1Z2xlMjAxMA==/font/5a6L5L2T/fontsize/400/fill/I0JBQk ...

  8. Stompjs websocket vue

    公司项目要求要有消息提醒机制 , 多方面考虑用了ActiveMQ ,基本上现在主流的后台语言都没啥问题 , php phthon java nodejs , 等等都没问题 , 各位道友可以去查阅相关资 ...

  9. [Scikit-Learn] - 数据预处理 - 归一化/标准化/正则化

    reference: http://www.cnblogs.com/chaosimple/p/4153167.html 一.标准化(Z-Score),或者去除均值和方差缩放 公式为:(X-mean)/ ...

  10. 【oracle ocp 知识点二】

    1.数据库操作语言 DML在运行时下面的语句 添加一个新行到表 更新表现出一定的线 从表删除现有行 一个事务处理是由一系列的DML语句逻辑组成 A.insert 每次插入一行数据 字符和日期的须要单引 ...