Im Kiran. Can any one help me with the C# code for denying access to the local drives?? when anyone try to access a drive ( thru cmd or double clicking the drive directly) it shud nt b allowed.. for that..
So hw can we do that programattically..???
Re: C# code to deny access to local hard disk drives
I think the closest you can get to the thing you want is to use a FileSystemWatcher class. But that will only work when your program is active of course.
Re: C# code to deny access to local hard disk drives
hi sknake....
dnt knw y u said a big NO.... sorry, we can do with the System.Management namespace... i did dat bt still some prblm is der.. i mean i can deny access to read,write,delete etc but i cannot change it back to the allowed state... Classes are there like
myDirectorySecurity.AddAccessRule(new FileSystemAccessRule(User, FileSystemRights.FullControl, AccessControlType.Allow)); but it is nt wrkng unfortunately.. dats y....
Its possible with System.Management namespace ... ok???
Re: C# code to deny access to local hard disk drives
hi ddanbe..
First of all thanx 4 ur reply...
Well i had done dat partilly with System.Management namespace... bt still som prblms... dats y...
ok i will check d FiuleSystemWatcher and wll let u knw..
Thanku sir.....
Re: C# code to deny access to local hard disk drives
sknake is right... This isn't a programming problem. This is more something that should be resolved by local security policies on a client machine. Are these machines part of a domain?
Re: C# code to deny access to local hard disk drives
file systems manage drives access, not programs or operating systems. you can modify the filing system's access rights to users by using applications to modify the security permissions in the filing system, but It wasn't designed to be modified frequently like that. you could end up with a completely inaccessible drive.
There are much better ways to go about it. I agree with Scott and Dan. not only can you not. If you do find a way, you most certainly shouldn't.
No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.