public void DownloadAttachment(int attachmentId) { AttachmentData result = contract.GetAttachment(attachmentId); System.Windows.Forms.FolderBrowserDialog dialog = new System.Windows.Forms.FolderBrowserDialog(); if (dialog.ShowDialog() != System.Windows.Forms.DialogResult.OK) { return; } FileStream fs = new FileStream(dialog.SelectedPath + @"\" + result.FileName, FileMode.CreateNew, FileAccess.ReadWrite); try { fs.Write(result.content, 0, result.content.Length); } catch (Exception ex) { MessageBox.Show("Отказано в доступе"); } }