-
April 22nd, 2005, 07:07 PM
#1
Permissions problem deleting folders
I'm coding in C#, but I think the issue is more of a general Windows programming issue than C# specific.
I am writing a program to clean up the residue of deleted accounts and what I'm trying to delete are extraneous profiles (ie., a profile with no corresponding account). The program runs on a domain controller and the profiles are on another server which is just a domain member. I can delete the profiles from that server directly, but when I try to delete them via program control from the domain controller, using the full UNC, I get permission denied errors. I am doing (more like trying to do) a recursive delete using the DirectoryInfo.delete(true) syntax in C#.
Is there something special I need go do because these are profiles? Any suggestions would be most appreciated.
Thanks,
Rob
-
April 24th, 2005, 10:25 PM
#2
Re: Permissions problem deleting folders
I can delete the profiles from that server directly, but when I try to delete them via program control from the domain controller, using the full UNC, I get permission denied errors.
This almost always indicates that the security context your program is running under does not have the same rights to delete files as your ID does.
It sounds like you are having your program launched by some other process rather than launching it while you are logged in under your ID.
-
April 25th, 2005, 11:24 AM
#3
Re: Permissions problem deleting folders
Just to test for the possibility of it being a security context issue, I invoked the C# program from the command line and again got the permission denied error. I then attempted to delete the profile from within the same command window using the DOS rmdir /S command with the full UNC path to the profile on the other system. It asked me if I was sure and then successfully deleted the directory -- no permissions issues.
So, if it is a security context issue, that would mean that a .NET program runs under a different context than the user that invoked it, even though it was invoked from a command prompt. Is that the case? And if so, where do I look to fix it?
Thanks,
Rob
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|