• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 296
  • Last Modified:

Restrict use of a network directory only while a program is running in windows

My software needs to read, and sometimes write files in a common directory in the network.
We have users type A and users type B. Users type A can write and read files in that directory, Users type B must only read in that directory but not write.
Outside my software, users should not read or write in that directory.
All users belong to the same domain.
I've tried to solve this with "net use X: ... " but it remains connected when my software ends and, while it is running, users can access drive X: so a batch file (with net use, MySoftware, net use /delete) is not a solution.
By the way, my software is developed using vb.net 2010.
Any idea to solve this?
0
BemboX
Asked:
BemboX
1 Solution
 
DaveCommented:
the classic solution would be client server, so you write a server app and connect using a pipe. otherwise you could have the program impersonate a second user e.g. "TYPEA" and "TYPEB" and set the share security appropriatly. details here:-

http://blogs.msdn.com/b/shawnfa/archive/2005/03/21/400088.aspx

http://williamfaulkner.co.uk/2009/04/vbnet-run-as-administrator-impersonate-a-user-2008/

or if you feel very brave just use hidden shares with "$" names and use UNC's not mappings in your program.

Have fun...
0
 
BemboXAuthor Commented:
Thanks a lot!!!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now