Unshared folder access.

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello all. I have a program that manages (delete, copy, open, etc) several
files inside a shared folder in a server, but the users some times use the
Windows Explorer to open and work with files, I do not want it, because my
program opens the files and store some data in a SQL database, so, if the
users open the files with Windows Explorer, my databse is not updated.
If I unshare this folder, in order to eliminate the access with Win
Explorer, how can I access with my program? I mean, my program has to read,
copy, delete, etc. files inside an unshared folder.

Thanks in advance,
William GS
 
Hello all. I have a program that manages (delete, copy, open, etc) several
files inside a shared folder in a server, but the users some times use the
Windows Explorer to open and work with files, I do not want it, because my
program opens the files and store some data in a SQL database, so, if the
users open the files with Windows Explorer, my databse is not updated.
If I unshare this folder, in order to eliminate the access with Win
Explorer, how can I access with my program? I mean, my program has to
read,
copy, delete, etc. files inside an unshared folder.

What you could do is use impersonation.
I.e. your app changes its security context to a special user that is the
only user that has privileges on that share. That user has to be allowed to
update the folder.

That way regular users cannot modify the share, but only your user (your
program) can.
www.codeproject.com has several articles on impersonation. one of them is
this:
http://www.codeproject.com/csharp/cpimpersonation1.asp
it is for C#, but if you are using C++/CLI or MC++ you can easily translate
it.

Another way would be to user RPC, or to write a service on your server that
listens to commands from your app, and then performs the action. Those
solutions require some more programming, but you don't need the share
anymore.
 
Back
Top