我想使用dropbox.api从Dropbox下载我的文件。
我目前的代码是
public static void download(ListBox file)
{
file.Items.Clear();
using (var dbx = new DropboxClient("mytoken"))
{
using (var responses = dbx.Files.DownloadAsync("/pakistan.txt"))
{
HttpContext.Current.Response.Clear();
HttpContext.Current.Response.ClearHeaders();
HttpContext.Current.Response.ClearContent();
HttpContext.Current.Response.AddHeader("Content-Disposition", attachment; filename=" + responses.Result.Response.Name);
HttpContext.Current.Response.AddHeader("Content-Length", responses.Result.Response.Size.ToString());
HttpContext.Current.Response.ContentType = "text/plain";
HttpContext.Current.Response.Flush();
HttpContext.Current.Response.TransmitFile(responses.Result.Response.Name);
HttpContext.Current.Response.End();
}
}
}
它正在下载文件,但文件中的内容并不完整。