Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. file download/copy from server to client

file download/copy from server to client

Scheduled Pinned Locked Moved Visual Basic
5 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Anoop Brijmohun
    wrote on last edited by
    #1

    Hi guys.... i have tried many ways to do this and have googled and searched msdn but to no avail. i want my client app.exe to check app.exe on the server. if the server app.exe is of a new version then the client app.exe to copy and overwrite itself. the reason for this is i have many client pc's at a site. i simply want to drop the latest app.exe on the server and whenever a client app.exe is launched then it should do the above check.thus the client app.exe is always the latest app. this is my code below.

    Dim objFSO As New Object
    Dim objLocalFile, objServerFile As New Object
    Dim dtmLocalDate, dtmServerDate As New Object

                    Const OverwriteExisting = True
    
                    'COPY FILE
    
                    objFSO = CreateObject("Scripting.FileSystemObject")
    
                    objLocalFile = objFSO.GetFile(My.Settings.LocalFile.ToString.Trim)
                    dtmLocalDate = objLocalFile.DateLastModified
    
                    objServerFile = objFSO.GetFile(My.Settings.ServerFile.ToString.Trim)
                    dtmServerDate = objServerFile.DateLastModified
    
                    If dtmLocalDate > dtmServerDate Then
                       objFSO.CopyFile(objServerFile.Path, objLocalFile.Path, OverwriteExisting)
                       'OR
                       'My.Computer.Network.DownloadFile("\\\\Server\\app.exe", "C:\\client\\app.exe", "domain\\username", "Password", True, 10000, True)
                    End If
    

    the error i get is.... "The system detected a possible attempt to compromise security. Please ensure that you can contact you server that authenticated you." thanks Anoop

    D 1 Reply Last reply
    0
    • A Anoop Brijmohun

      Hi guys.... i have tried many ways to do this and have googled and searched msdn but to no avail. i want my client app.exe to check app.exe on the server. if the server app.exe is of a new version then the client app.exe to copy and overwrite itself. the reason for this is i have many client pc's at a site. i simply want to drop the latest app.exe on the server and whenever a client app.exe is launched then it should do the above check.thus the client app.exe is always the latest app. this is my code below.

      Dim objFSO As New Object
      Dim objLocalFile, objServerFile As New Object
      Dim dtmLocalDate, dtmServerDate As New Object

                      Const OverwriteExisting = True
      
                      'COPY FILE
      
                      objFSO = CreateObject("Scripting.FileSystemObject")
      
                      objLocalFile = objFSO.GetFile(My.Settings.LocalFile.ToString.Trim)
                      dtmLocalDate = objLocalFile.DateLastModified
      
                      objServerFile = objFSO.GetFile(My.Settings.ServerFile.ToString.Trim)
                      dtmServerDate = objServerFile.DateLastModified
      
                      If dtmLocalDate > dtmServerDate Then
                         objFSO.CopyFile(objServerFile.Path, objLocalFile.Path, OverwriteExisting)
                         'OR
                         'My.Computer.Network.DownloadFile("\\\\Server\\app.exe", "C:\\client\\app.exe", "domain\\username", "Password", True, 10000, True)
                      End If
      

      the error i get is.... "The system detected a possible attempt to compromise security. Please ensure that you can contact you server that authenticated you." thanks Anoop

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      You need to write a seperate app that does the check and downloads a new .EXE. You cannot overwrite an .EXE that's already running, so it has to be done by a seperate app. And why on earth are you using the FileSystemObject when all of it's functionality and WAY MORE, can be found in the System.Io namespace in the .NET Framework??

      A guide to posting questions on CodeProject[^]
      Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
           2006, 2007, 2008

      A 1 Reply Last reply
      0
      • D Dave Kreskowiak

        You need to write a seperate app that does the check and downloads a new .EXE. You cannot overwrite an .EXE that's already running, so it has to be done by a seperate app. And why on earth are you using the FileSystemObject when all of it's functionality and WAY MORE, can be found in the System.Io namespace in the .NET Framework??

        A guide to posting questions on CodeProject[^]
        Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
             2006, 2007, 2008

        A Offline
        A Offline
        Anoop Brijmohun
        wrote on last edited by
        #3

        hi, using FileSystemObject cos i was not able to download the file usind my.computer.network.download. i was just trying different options. yes, i have created a seperate app to check both versions before overwrite, however im still getting the same error, with network authentication. thanks

        D 1 Reply Last reply
        0
        • A Anoop Brijmohun

          hi, using FileSystemObject cos i was not able to download the file usind my.computer.network.download. i was just trying different options. yes, i have created a seperate app to check both versions before overwrite, however im still getting the same error, with network authentication. thanks

          D Offline
          D Offline
          Dave Kreskowiak
          wrote on last edited by
          #4

          I have no idea what's going wrong with your setup. The original code you had does work, so it's got to be something in your network's setup that you don't know about that's causing the failure. I already told you how to specify the username with the domain the user account is in, so there's something else you have to talk to your network people about to get the answer. What's causing the problem is specific to your network environment.

          A guide to posting questions on CodeProject[^]
          Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
               2006, 2007, 2008

          A 1 Reply Last reply
          0
          • D Dave Kreskowiak

            I have no idea what's going wrong with your setup. The original code you had does work, so it's got to be something in your network's setup that you don't know about that's causing the failure. I already told you how to specify the username with the domain the user account is in, so there's something else you have to talk to your network people about to get the answer. What's causing the problem is specific to your network environment.

            A guide to posting questions on CodeProject[^]
            Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                 2006, 2007, 2008

            A Offline
            A Offline
            Anoop Brijmohun
            wrote on last edited by
            #5

            thanks, will do so!

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups