CAS does not check NT security. It checks the rights of the code to do
certain operations, not the user running the code.
The easiest and most reliable way to check check access to NT protected
resources is to try to open them and catch the UnauthorizedAccessException
that might happen. If you want to do this programmatically, you probably
want to be looking at p/invoke on the AccessCheck API function.
Joe K.
> Let me expand on my question. From what i understand CAS checks if the
> calling assembly has rights to a certian resource. But what about plain
[quoted text clipped - 11 lines]
>> Thanks,
>> John
Thats what I was afraid of. I am really under the belief that using try/catch
to control process flow is BAD practice, but I dont think I have another
choice.
"Joe Kaplan (MVP - ADSI)" wrote:
> CAS does not check NT security. It checks the rights of the code to do
> certain operations, not the user running the code.
[quoted text clipped - 21 lines]
> >> Thanks,
> >> John
Joe Kaplan \(MVP - ADSI\) - 12 May 2005 21:18 GMT
I totally agree. However, in this case, the only way to be 100% sure is to
try it.
AccessCheck is viable though and might not be that hard to do. Check
pinvoke.net to see if anyone has already written a wrapper.
Even if you use AccessCheck to verify access, the ACL on the object could
certainly change between the time you check it and the time you go to access
it, so you still need the try/catch. The resource could also get deleted
out from under you for that matter.
Best of luck,
Joe K.
> Thats what I was afraid of. I am really under the belief that using
> try/catch
[quoted text clipped - 32 lines]
>> >> Thanks,
>> >> John