2012-04-21 50 views
0

我無法弄清楚如何設置授權在下面如何使用HttpClient的查詢AzureTable其餘API

static string _address = "http://Foo.table.core.windows.net/BackupEntries()?select=RowKey"; 

    static void Main(string[] args) 
    { 

     // Create an HttpClient instance 
     HttpClient client = new HttpClient(); 
     client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("aa", ""); 

回答

-1

這是老了一步,但你可以嘗試

string Userid = string.Empty; 
    string Pwd = string.Empty; 



     byte[] bytes = Encoding.ASCII.GetBytes(String.Format("{0}:{1}", Userid, Pwd)); 
     var authorization = "basic " + Convert.ToBase64String(bytes); 
     fr.Headers.Add("Authorization", authorization); 
+0

Windows Azure存儲不使用基本身份驗證。要構建適當的auth頭文件,您需要對請求(正在訪問的資源和各種頭文件的組合)進行簽名。 – smarx 2012-04-21 21:48:08