2013-04-10 59 views
0

我設法在c#中創建加密密鑰對話框(代碼如下),並獲得響應消息的狀態代碼。沒關係。Windows商店應用程序 - 加密密鑰對話框

但現在我想知道,如果這同樣的想法可以在JavaScript項目中完成?我更喜歡使用JavaScript,因爲我無法獲得在c#中工作的ajax請求(我使用它來訪問來自api的數據)。

 try 
     { 
      HttpClientHandler aHandler = new HttpClientHandler(); 
      aHandler.ClientCertificateOptions = ClientCertificateOption.Automatic; 

      HttpClient aClient = new HttpClient(aHandler); 
      HttpResponseMessage aResp = await aClient.GetAsync("https://www.somelink.com/"); //this is not the link I used 
      txtBlock.Text = aResp.StatusCode.ToString(); 
     } 
     catch (Exception theEx) 
     { 
      txtBlock.Text = theEx.Message; 
     } 

enter image description here

回答