943,689 Members | Top Members by Rank

Ad:
  • C# Discussion Thread
  • Unsolved
  • Views: 1354
  • C# RSS
Aug 8th, 2009
0

C# code to deny access to local hard disk drives

Expand Post »
Hi,

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..???

Plz help me.......
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
getkiran1 is offline Offline
10 posts
since Jun 2008
Aug 8th, 2009
0

Re: C# code to deny access to local hard disk drives

You can't. Whatever you are trying to do you are going about it the wrong way. This is more to do with security policies than programming.
Featured Poster
Reputation Points: 1749
Solved Threads: 735
Senior Poster
sknake is offline Offline
3,948 posts
since Feb 2009
Aug 8th, 2009
0

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.
Reputation Points: 2023
Solved Threads: 644
Senior Poster
ddanbe is offline Offline
3,736 posts
since Oct 2008
Aug 8th, 2009
0

Re: C# code to deny access to local hard disk drives

Good morning danny

You're working on the weekends too I see
Featured Poster
Reputation Points: 1749
Solved Threads: 735
Senior Poster
sknake is offline Offline
3,948 posts
since Feb 2009
Aug 8th, 2009
0

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

Thankzzzzzzz
Reputation Points: 10
Solved Threads: 0
Newbie Poster
getkiran1 is offline Offline
10 posts
since Jun 2008
Aug 8th, 2009
0

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.....
Reputation Points: 10
Solved Threads: 0
Newbie Poster
getkiran1 is offline Offline
10 posts
since Jun 2008
Aug 13th, 2009
0

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?
Team Colleague
Reputation Points: 186
Solved Threads: 147
Cookie... That's it
alc6379 is offline Offline
2,519 posts
since Dec 2003
Aug 13th, 2009
0

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.
Reputation Points: 442
Solved Threads: 89
Master Poster
Diamonddrake is offline Offline
721 posts
since Mar 2008

This thread is more than three months old

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.
Message:
Previous Thread in C# Forum Timeline: Getting started with C#
Next Thread in C# Forum Timeline: Update website control from usercontrol?





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC