中文字幕在线观看,亚洲а∨天堂久久精品9966,亚洲成a人片在线观看你懂的,亚洲av成人片无码网站,亚洲国产精品无码久久久五月天

C# 發(fā)起HTTP請(qǐng)求并檢查回應(yīng)的Cookie數(shù)據(jù)

2018-07-20    來(lái)源:open-open

容器云強(qiáng)勢(shì)上線(xiàn)!快速搭建集群,上萬(wàn)Linux鏡像隨意使用
 
/**
   Examine Cookies. 
   
   To see what cookies a Web Site uses, 
   specify its name on the command line. 
   For example, if you call this program 
   Cookie, then 
    
     Cookie http://MSN.COM 
    
   displays the cookies associated with MSN.COM. 
*/
   
using System; 
using System.Net; 
   
public class CookieDemo {  
  public static void Main(string[] args) { 
   
    if(args.Length != 1) { 
      Console.WriteLine("Usage: CookieDemo <uri>"); 
      return ; 
    } 
   
    // Create a WebRequest to the specified URI. 
    HttpWebRequest req = (HttpWebRequest) 
           WebRequest.Create(args[0]);  
   
    // Get an empty cookie container. 
    req.CookieContainer = new CookieContainer(); 
   
    // Send the request and return the response. 
    HttpWebResponse resp = (HttpWebResponse) 
           req.GetResponse(); 
   
    // Display the cookies. 
    Console.WriteLine("Number of cookies: " +  
                        resp.Cookies.Count); 
    Console.WriteLine("{0,-20}{1}", "Name", "Value"); 
   
    for(int i=0; i < resp.Cookies.Count; i++) 
      Console.WriteLine("{0, -20}{1}", 
                         resp.Cookies[i].Name, 
                         resp.Cookies[i].Value); 
   
    // Close the Response.  
    resp.Close(); 
  } 
}


標(biāo)簽: isp

版權(quán)申明:本站文章部分自網(wǎng)絡(luò),如有侵權(quán),請(qǐng)聯(lián)系:west999com@outlook.com
特別注意:本站所有轉(zhuǎn)載文章言論不代表本站觀(guān)點(diǎn)!
本站所提供的圖片等素材,版權(quán)歸原作者所有,如需使用,請(qǐng)與原作者聯(lián)系。

上一篇: android 利用socket 發(fā)送Json數(shù)據(jù)demo

下一篇:python多線(xiàn)程多隊(duì)列