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

Posted on 2011-10-05
Last Modified: 2012-05-12
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 2010.
Any idea to solve this?
Question by:BemboX
    LVL 12

    Accepted Solution

    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:-

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

    Have fun...

    Author Closing Comment

    Thanks a lot!!!

    Featured Post

    Highfive Gives IT Their Time Back

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    If your business is like most, chances are you still need to maintain a fax infrastructure for your staff. It’s hard to believe that a communication technology that was thriving in the mid-80s could still be an essential part of your team’s modern I…
    If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
    Viewers will learn how to connect to a wireless network using the network security key. They will also learn how to access the IP address and DNS server for connections that must be done manually. After setting up a router, find the network security…
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

    745 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now