file download/copy from server to client
-
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 ObjectConst 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
-
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 ObjectConst 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
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 -
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, 2008hi, 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
-
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
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 -
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, 2008thanks, will do so!