zoukankan      html  css  js  c++  java
  • C#如何使用httpwebrequest通过代理访问网页

    string urlStr = "http://www.itstrike.cn";                              //设定要获取的地址
    HttpWebRequest hwr = (HttpWebRequest)HttpWebRequest.Create(urlStr);      //建立HttpWebRequest对象
    hwr.Timeout = 60000;                                                  //定义服务器超时时间
    WebProxy proxy = new WebProxy();                                      //定义一个网关对象
    proxy.Address = new Uri("http://proxy.domain.com:3128");              //网关服务器端口:端口
    proxy.Credentials = new NetworkCredential("f3210316", "6978233");      //用戶名,密码
    hwr.UseDefaultCredentials = true;                                      //启用网关认证
    hwr.Proxy = proxy;                                                      //设置网关
  • 相关阅读:
    数据库连接池
    数据库操作
    cookie/session
    楼梯问题
    Response/Request
    Web
    Exception
    jQuery效果与事件方法
    jQuery基础知识点
    布局的几种形式
  • 原文地址:https://www.cnblogs.com/zhengrunqiang/p/3130917.html
Copyright © 2011-2022 走看看