Ejemplo n.º 1
0
 /// <summary>
 /// 构造新的HttpClient实例
 /// </summary>
 /// <param name="url">要获取的资源的地址</param>
 /// <param name="expect100Continue">是否使用100-continue行为(默认为false,对于非IIS服务器向其POST数据时可能会出现471错误,将该参数设置为false可以避免这个问题)</param>
 /// <param name="context">Cookie及Referer</param>
 /// <param name="keepContext">是否自动在不同的请求间保留Cookie, Referer</param>
 public HttpClient(string url, bool expect100Continue, HttpClientContext context, bool keepContext)
 {
     ServicePointManager.Expect100Continue = expect100Continue;
     this.url = url;
     this.context = context;
     this.keepContext = keepContext;
     if (this.context == null)
         this.context = new HttpClientContext();
 }
Ejemplo n.º 2
0
 /// <summary>
 /// 构造新的HttpClient实例
 /// </summary>
 /// <param name="url">要获取的资源的地址</param>
 /// <param name="expect100Continue">是否使用100-continue行为(默认为false,对于非IIS服务器向其POST数据时可能会出现471错误,将该参数设置为false可以避免这个问题)</param>
 /// <param name="context">Cookie及Referer</param>
 public HttpClient(string url, bool expect100Continue, HttpClientContext context)
     : this(url, expect100Continue, context, false)
 {
 }