One of the ways to do this would be to create a share on the fly in your
application
for the folder where the required files are located whenever you need to
access those
files. This can be accomplished using WMI. However, the process requires to
connect
to the server which means you would have to hard code the server machines
password
into the application code. Another issue is the speed - if you have to
access your files
several times within the application, you might have to do this time and
again. You could
try to keep the share till the application is being run and delete the share
when the user
exits the application. The down side is that the files are accessible
atleast as long as the
application is running.
Another way would be to dynamically set the permissions of the folder within
your code.
You grant access to the folder to the user running your application on the
fly within your
code and reset the permissions when the user exits. But it still suffers
from the same flaw
as the above method. You can either set the permissions using WMI or you
could use
setACL.exe (freeware available at http://www.helge.mynetcologne.de/setacl/)
to
accoomplish that. You might still need to logon to your server from within
your code
using WMI.
Hope this helps,
Imran.
Quote:
> My VB.NET application uses files located on the server. I do not want the
> user to open or even to see those files outside of my application. How can
I
> access those files from my app. For now I run *.cmd file which
establishes
> Virtual Private Network and maps the server drive on workstation. Files on
> that drive are ready for use. But since I made this drive available for
> application it is also available for the direct user access. I would like
to
> prevent it. How can I do that?
> Thank you
> Vlad