public void WriteFileContentsFromUrl(string contentUrl, string filePath)
{
WebClient request = new WebClient();
request.UseDefaultCredentials = true;
byte[] fileContent = request.DownloadData(contentUrl);
FileStream fs = new FileStream(filePath, FileMode.OpenOrCreate, FileAccess.ReadWrite);
BinaryWriter bw = new BinaryWriter(fs);
bw.Write(fileContent);
bw.Close();
}