Downloading from Winhost to user account

Discussion in 'General troubleshooting' started by Paul Rothenheber, Oct 1, 2014.

  1. I am currently trying to download an .exe using the following code:

    Dim setup AsString = ""
    Dim copyto AsString = "C:\HTESInc\setup.exe"
    If System.IO.File.Exists(copyto) Then
    My.Computer.Network.DownloadFile(setup, copyto)

    The file is located withing the folder HTESPublish.

    I can run this from LocalHost and it downloads successfully. When I run it from Winhost, it does not recognize the file.

    Any one do a Download? If so can you share your code?

    Last edited by a moderator: Oct 14, 2015
  2. ComputerMan

    ComputerMan Winhost Staff

    I think you have to change the MIME Type of the exe file to: application/octet-stream

    By default it should already be set as application/octet-stream.

    You can do this using IIS Manager. Read our knowledge base article on how to connect to your site using IIS Manager here:

    Once connected click on Double click on "MIME Types" icon in IIS Manager.

    Look for the extension ".exe" right click and select "Edit". Change the MIME Type to: application/octet-stream now click "OK".

    If the above information doesn't help what error message are you getting?
    Last edited by a moderator: Oct 14, 2015
    Michael likes this.
  3. The code I am using to download a .zip file is:

    Dim frm AsString = ""
    Dim copyto AsString = "C:/HTESInc/"

    My.Computer.Network.DownloadFile(frm, copyto)

    If System.IO.File.Exists(copyto) Then
    tbmessage.Text = "File has been downloaded"

    When I run this I receive the message that "File has been downloaded". But I go to my C:/HTESInc/ and it is not there? Weird.

    Is there a better way to download a .zip file from the WEBSITE?

    What could I be doing wrong????
  4. Elshadriel

    Elshadriel Winhost Staff

    Try changing this:

    Dim copyto AsString = "C:/HTESInc/"


    Dim copyto AsString = "C:\HTESInc\"

    You might need to escape the back slashes.
    Michael likes this.
  5. Tried everything

    Here is my current code

    Dim fileReader AsNewWebClient()
    Dim fileAddress = ""
    fileReader.DownloadFile(fileAddress, "")
    Catch ex AsException
    tbmessage.Text = ex.Message
    tbmessage.Text = "It works"

    I get "It Works" but No file is downloaded to my C: Drive

    Any other ideas. Anyone have sample code that works for them??
  6. Elshadriel

    Elshadriel Winhost Staff

    You can take a look at the sample code here.
  7. I found a way using JavaScript to Download . thanks so much for your support on this matter.
    Elshadriel likes this.

Share This Page