Advertisement

C#通过异步请求获取JSON数据

阅读量:

1 初始化访问流程

复制代码
 public static void StartAccessingURL(string url,int index)

    
     {
    
         try
    
         {
    
             HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(url);
    
  
    
             webRequest.Method = "Get";
    
             webRequest.ContentType = "application/json";
    
             webRequest.Headers.Add("Authorization", "MzQ1");  //token
    
  
    
             
    
             webRequest.BeginGetResponse(new AsyncCallback(OnOneResponse), webRequest);
    
         }
    
         catch(Exception ex)
    
         {
    

全部评论 (0)

还没有任何评论哟~