Hello,
you have to deal with several security layers here:
CAS - Your application may run in a zone which prevents you from accessing
files on the computer
NTFS Permissions - The security descriptor on the directory does not permit
access to the user account running under which your program runs.
And the latter is difficult to detect unless you just try it:
try {
files = Directory.GetFiles(path);
}
catch (UnauthorizedAccessException) {
accessDenied = true;
}
catch (SecuriyException) {
accessDenied = true;
}
Kind regards,
Henning Krause
>I tried the following but it tells me for every folder on my pc that I
>would not have access to it.
[quoted text clipped - 10 lines]
> acessDenied = true;
> }
cody - 25 Feb 2008 00:03 GMT
> you have to deal with several security layers here:
>
[quoted text clipped - 14 lines]
> accessDenied = true;
> }
That's bad, as this is what Iam currently doing. The lot of exceptions
thrown and popping off in Visual Studio annoy me (I know I can turn this
off) and I thought it is not good style.
But it looks like I have to go with it..
Nevertheless, thank you for clearing things up for me!