Morcos Adel

Morcos Adel

  • NA
  • 195
  • 50.2k

Download File From a web service

Jun 9 2011 5:40 AM
Hi
I ran into a problem while i am trying to download a file from a web service server actually i do get the file to the page perfectly but the problem is how to poup the download dialog from the Internet explorer :

Web Service Code :
[WebMethod]
public byte[] DownloadFile(String DocumentName)
{
String completeFileName = Path.Combine(@"\\10.0.55.172\repos", DocumentName);
FileStream FileStream = null;
File.Open(completeFileName, FileMode.Open, FileAccess.Read);
byte[] Bytes = new byte[FileStream.Length];
FileStream.Read(Bytes, 0, (int)FileStream.Length);
FileStream.Close();
return Bytes;
}

Web Page Code:
Protected void LinkBtn_click(object sender,EventArgs e)
{
Service1 service=new Service1();
byte[] FileBytes = null;
FileBytes = Service.DownloadFile("100481.docx");
MemoryStream memo = new MemoryStream(FileBytes);
}
No i have The File In An array of bytes or a MemoryStream My question is How to popup the Download Dialog from the Browser????
It should be easy,right?????!!!!
Thanks In advance

Answers (1)