c# Dropbox 通过 httpwebrequest 下载文件

c# Dropbox download file by httpwebrequest

我有一个 'ASP.NET' 控制台应用程序,我使用 Dropbox API https://content.dropboxapi.com/1/files/auto/<path> to download content from 我只有 AppKeyAppSecretAccess Token , Token Secret 和文件的 path.

如何使用httpwebrequest发送请求。

我在 google 中搜索,我在 link 中找到了最佳答案:

 string url = String.Format("https://content.dropboxapi.com/1/files/auto{0}?oauth_consumer_key={1}&oauth_token={2}&oauth_signature={3}%26{4}", path, app-key, access-token, app-secret, access-token-secret);
 HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(url);
 webRequest.Method = "Get";
 WebResponse webResponse = null;
  try
  {
     webResponse = webRequest.GetResponse();
     return webResponse.GetResponseStream();
  }
  catch (Exception ex)
  {
    throw ex;       
  }