Ejemplo n.º 1
0
 /// <summary>
 /// 创建GET方式的HTTP/HTTPS请求
 /// </summary>
 /// <param name="url">请求的URL</param>
 /// <param name="timeout">请求的超时时间</param>
 /// <param name="userAgent">请求的客户端浏览器信息,可以为空</param>
 /// <param name="requestEncoding">发送HTTP请求时所用的编码</param>
 /// <param name="cookies">随同HTTP请求发送的Cookie信息,如果不需要身份验证可以为空</param>
 /// <returns></returns>
 public static HttpWebResponse CreateGet(string url, int?timeout  = null, string userAgent = null,
                                         CookieCollection cookies = null)
 {
     return(Create(url, null, "GET", requestEncoding, timeout, cookies.ToString()));
 }