Jenn Huynh

Jenn Huynh

  • NA
  • 9
  • 0

How to send the request to Web Server and download FileStream to client's machine?

Jun 27 2008 12:52 PM

Hello,

I have a Web Service download site and this Web Service will receive 3 input parameters (username, password, servicetype).  From a Client side, he/she has to formulate a url string with 3 parameters to the DownloadFile function in Web Service and in return will be data in byte array.  I try to tested from Client side and send the request to the Web Server by HttpWebRequest and HttpWebResponse to get data in byte array and then using the FileStream to write to Client's machine, but unable to archieve the task, Does anyone knows the method of how to send the request to the Web Server and Save/Download file stream to client directory?  Thanks

[WebMethod()]

public byte[] DownloadFile(string username, string password, string servicetype)

{

//Return data as byte array to Client

}