0

In SugarSync...I am using the Below code to download the PDF file. After saving When I open the PDF file...It says file is corrupted

String Url = "https://api.sugarsync.com/file/:sc:1188464:46431595_224319/version/46431595_150662/data";
WebClient c = new WebClient();
c.Headers["Authorization"] = accessToken;    
c.DownloadFile(Url, @"d:\abc.pdf");
  • Do you have the same issue if you dispose your `WebClient` instance after the download? Regardless of whether or not this helps, you should have a `c.Dispose();` or wrap the code in a `using (var c = new WebClient()) { ... }`. – Enigmativity Apr 15 '15 at 05:36
  • check this question http://stackoverflow.com/questions/307688/how-to-download-a-file-from-a-url-in-c – Peyman Apr 15 '15 at 05:39

0 Answers0