locked
Download .exe from server to mobile RRS feed

  • Question

  • Hello

    i want to download an exe file and txt document from a server to my windows mobile phone. i am using vb.net.i tried to use http requet and web requests to do that and was able to copy the content of the txt file..but did not know how to copy the exe and save it on a local path in the mobile phone. 

    i used the following:

    Dim request = DirectCast(HttpWebRequest.Create _
    (path), WebRequest)
    request.Timeout = 50000
    Try
    Dim response As HttpWebResponse = DirectCast(request.GetResponse(), WebResponse)
    Dim inStream As StreamReader

    inStream = New StreamReader(response.GetResponseStream())
    MsgBox(inStream.ReadToEnd)

    any help would be appreciated 

    Tuesday, December 18, 2012 2:19 PM

Answers

  • Pretty much the same, only you would need to read bytes into the buffer and then write that buffer to the file stream. 

    MSDN has sample which does pretty much that here: http://msdn.microsoft.com/en-us/library/system.io.filestream.read.aspx

    If your file is large then you probably should change the sample to read smaller portions of the file and write them in a loop.


    This posting is provided "AS IS" with no warranties, and confers no rights.

    • Marked as answer by Elegentin Xie Tuesday, December 25, 2012 4:05 AM
    Tuesday, December 18, 2012 8:38 PM

All replies

  • Pretty much the same, only you would need to read bytes into the buffer and then write that buffer to the file stream. 

    MSDN has sample which does pretty much that here: http://msdn.microsoft.com/en-us/library/system.io.filestream.read.aspx

    If your file is large then you probably should change the sample to read smaller portions of the file and write them in a loop.


    This posting is provided "AS IS" with no warranties, and confers no rights.

    • Marked as answer by Elegentin Xie Tuesday, December 25, 2012 4:05 AM
    Tuesday, December 18, 2012 8:38 PM
  • thanks for your reply:D

    i managed to read txt files..but my problem is that i want to download an .exe file from a shared folder to my windows mobile PDA. So any suggestions?

    Wednesday, December 19, 2012 9:43 AM
  • Yes I do, see my post above.

    This posting is provided "AS IS" with no warranties, and confers no rights.

    Wednesday, December 19, 2012 5:32 PM
  • Hi,

    I have marked Iiya's reply as answer.
    If you disagree, please unmark it, and post your doubt.

    Regards,


    Elegentin Xie
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Tuesday, December 25, 2012 4:05 AM