Re: File IO Permissions



FileIOPermission has nothing to do with OS ACLs/Privileges - it is a CAS thing - which is a different security model.

I am not aware of a good way of doing those checks - besided trying to open the file - and see if an exception gets thrown.

---------------------------------------
Dominick Baier - DevelopMentor
http://www.leastprivilege.com

Hi all,
I am trying to write a piece of code that will allow me to check if
the
current user has permission to access (read, write, etc.) a certain
folder
before I try to access it for the read, write, etc. I tried to use
FileIOPermission class and the Demand method, but it doesn't appear to
break if the user doesn't have permission. Any help would be
appreciated.

Thanks!

Aaron Sellers



.



Relevant Pages

  • Re: use CAS demand or not?
    ... > FileIOPermission, then if the assembly attempts to do File IO, the .NET ... There's really no need to duplicate permission demands in this way. ... consider using assembly-level RequestMinimum permission attributes instead. ... one only makes CAS permission demands in code that makes ...
    (microsoft.public.dotnet.security)
  • Re: FileIOPermission question
    ... because I have no permission to access the files on this computer. ... to conclude if I test the file access with the FileIOPermission class, ... bool bHasAccess = true; ... If you inspect the exception that is occurring in the second try...catch ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Declarative FileIOPermission and variable directories
    ... but I was putting a FileIOPermission at the assembly level as ... > Is there a reason why you cannot use programmatic permission check instead ... >> Anyone else have a thought on specifying directories for a permission ...
    (microsoft.public.dotnet.security)
  • Help - How am I misusing FileIOPermission?
    ... FileIOPermission, but can't seem to get it to work. ... See my sample app below, for an app that tries to demand a permission ... udeDirs, SearchOption searchOption) ...
    (microsoft.public.dotnet.general)
  • Re: FileIOPermission question
    ... because I have no permission to access the files on this computer. ... to conclude if I test the file access with the FileIOPermission class, ... bool bHasAccess = true; ... If you inspect the exception that is occurring in the second try...catch ...
    (microsoft.public.dotnet.languages.csharp)