woodwyn
asked on
How to allow multiple VFP app users to transfer files to a secured shared directory.
How to allow multiple VFP app users to transparently transfer files to a secured shared directory.
I have multiple users connecting to a RDS server hosted on my domain. There is a VPN between my domain and the users domain. Once connected to the RDS server, they run their VFP app. From within the VFP app, they select a file using GetFile(). That works fine. Once a file is selected I want to automatically transfer the file to a shared directory, locked down to admins only. Users wont have any access to the share except to upload files to it from within the VFP app.
Here's a mockup of the credentials provided to me to access the share:
Domain: TheUsersDomains
Username: filestorageuser (given admin rights)
Password: FileStorePassw0rd
Location: \\TheirServer\FileStorage
At first, I replaced TheirServer with their servers IP, but VFP doesn’t seem to like IPs in a path, so I added a record to my workstations and to the RDS servers Hosts files. Then, on my workstation, I connected to the server in File Explorer, entering in the credentials, and now VFP will upload files to it from my workstation. However, when I create an executable and send it to the RDS server and try to upload files to the shared directory, I am given an error about …invalid path…
I have found some suggestions of a work around like this (I don't want to create a mapped drive the users can access outside of VFP):
oNet = CreateObject('WScript.Netw ork')
oNet.MapNetworkDrive('I',' \\TheirSer ver\FileSt orage',.T. ,'filestor ageuser',' FileStoreP assw0rd')
Or this:
net use DriveLetter: \\TheirServer\FileStorage
There was one suggestion that we install FileZilla on TheirServer, set up a generic account that will not be shared with the users and use FTP to transfer the files from within the VFP app. I don't recall ever using FTP with VFP myself, but it appears to be a viable solution.
What do you think is the best solution for me here?
I have multiple users connecting to a RDS server hosted on my domain. There is a VPN between my domain and the users domain. Once connected to the RDS server, they run their VFP app. From within the VFP app, they select a file using GetFile(). That works fine. Once a file is selected I want to automatically transfer the file to a shared directory, locked down to admins only. Users wont have any access to the share except to upload files to it from within the VFP app.
Here's a mockup of the credentials provided to me to access the share:
Domain: TheUsersDomains
Username: filestorageuser (given admin rights)
Password: FileStorePassw0rd
Location: \\TheirServer\FileStorage
At first, I replaced TheirServer with their servers IP, but VFP doesn’t seem to like IPs in a path, so I added a record to my workstations and to the RDS servers Hosts files. Then, on my workstation, I connected to the server in File Explorer, entering in the credentials, and now VFP will upload files to it from my workstation. However, when I create an executable and send it to the RDS server and try to upload files to the shared directory, I am given an error about …invalid path…
I have found some suggestions of a work around like this (I don't want to create a mapped drive the users can access outside of VFP):
oNet = CreateObject('WScript.Netw
oNet.MapNetworkDrive('I','
Or this:
net use DriveLetter: \\TheirServer\FileStorage
There was one suggestion that we install FileZilla on TheirServer, set up a generic account that will not be shared with the users and use FTP to transfer the files from within the VFP app. I don't recall ever using FTP with VFP myself, but it appears to be a viable solution.
What do you think is the best solution for me here?
ASKER
I'm trying something like this, but even though I remove the temporary mapped drive I get the following error if I need to temporarily recreate it.
lcDrive='\\ADCH\ISFileStor age\2019\O -100001'
DriveExists = (DRIVETYPE("M:") # 1)
oNet = CreateObject('WScript.Netw ork')
IF DriveExists
* This is to avoid an error in case the drive did not get deleted last time through
oNet.RemoveNetworkDrive('M :',.T.)
ENDIF
oNet.MapNetworkDrive('M:', lcDrive,.T .,'isfiles torageuser ','19FileS tore*')
* With a connection made to the server I can now create folders and upload files within my VFP code
oNet.RemoveNetworkDrive('M :',.T.)
RELEASE oNet
The error I get when hitting this line
oNet.MapNetworkDrive('M:', lcDrive,.T .,'isfiles torageuser ','19FileS tore*')
the second time through:
OLI IDidpatch exception code 0 from WSHNetwork.MatpNetworkDriv e:
The local device name has a remembered connection to another network resource.
If I change the drive letter from M to something else not in use, everything else works again.
lcDrive='\\ADCH\ISFileStor
DriveExists = (DRIVETYPE("M:") # 1)
oNet = CreateObject('WScript.Netw
IF DriveExists
* This is to avoid an error in case the drive did not get deleted last time through
oNet.RemoveNetworkDrive('M
ENDIF
oNet.MapNetworkDrive('M:',
* With a connection made to the server I can now create folders and upload files within my VFP code
oNet.RemoveNetworkDrive('M
RELEASE oNet
The error I get when hitting this line
oNet.MapNetworkDrive('M:',
the second time through:
OLI IDidpatch exception code 0 from WSHNetwork.MatpNetworkDriv
The local device name has a remembered connection to another network resource.
If I change the drive letter from M to something else not in use, everything else works again.
ASKER
Remembering that I need to display the folder contents, FTP does not solve all my issues. I still need the user to have temporary access to that server to capture the contents.
Also, here’s another real time example of a possible use to this approach. I am creating a job folder (\\ADCH\ISFileShare\Yearof Show\JobNu mber) for each job. This is where they will dump final, read only versions of docs. I have a recursive program that I am working on that will display all the contents of the job folder for an easy view within my app. Here I check to see if the folder exists and if it doesn’t I create it. This also shows that FTP won’t solve my problem because I need to search for and create these folders on the fly and seamlessly to the user.
oNet = CreateObject('WScript.Netw ork')
DriveExists = (DRIVETYPE("M:") # 1)
IF DriveExists
oNet.RemoveNetworkDrive('M :',.T.)
ENDIF
lcJobNum=ALLTRIM(oLib.GetW orkorderKe ysJobNum(v Workorders .keyWorkor ders))
lcYear=ALLTRIM(STR(YEAR(vS hows.ShowD ate)))
lcFolderPath='\\ADCH\ISFil eStorage\' +lcYear+'\ '+lcJobNum
lcDrive='\\ADCH\ISFileStor age\'+lcYe ar
oNet.MapNetworkDrive('M:', lcDrive,.T .,'isfiles torageuser ','19FileS tore*')
llDir=DIRECTORY(lcFolderPa th)
IF !llDir
MD (lcFolderPath)
ENDIF
DriveExists = (DRIVETYPE("M:") # 1)
IF DriveExists
oNet.RemoveNetworkDrive('M :',.T.)
ENDIF
RELEASE oNet
Also, here’s another real time example of a possible use to this approach. I am creating a job folder (\\ADCH\ISFileShare\Yearof
oNet = CreateObject('WScript.Netw
DriveExists = (DRIVETYPE("M:") # 1)
IF DriveExists
oNet.RemoveNetworkDrive('M
ENDIF
lcJobNum=ALLTRIM(oLib.GetW
lcYear=ALLTRIM(STR(YEAR(vS
lcFolderPath='\\ADCH\ISFil
lcDrive='\\ADCH\ISFileStor
oNet.MapNetworkDrive('M:',
llDir=DIRECTORY(lcFolderPa
IF !llDir
MD (lcFolderPath)
ENDIF
DriveExists = (DRIVETYPE("M:") # 1)
IF DriveExists
oNet.RemoveNetworkDrive('M
ENDIF
RELEASE oNet
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
This issue was complicated by the customer informing me that the data host actually resides at an offsite facility, meaning the security issues were outside of my control. My solution was to create a SQL (their backend) table that holds requests for files transfers. Then I created a monitor that resides on a server without security issues to anywhere and the monitor transfers the files. Thanks again. I'll close this ticket and disburse points.
It seems that there is also the idea of hiding a mapped drive but right now i cannot test it.
FTP is also a great solution nonetheless..here is a post on it : https://www.tek-tips.com/faqs.cfm?fid=3234