Re: System.Security.Permissions.FileIOPermission

From: Eric Phetteplace (ericp_at_nextivr.com)
Date: 06/12/04


Date: Fri, 11 Jun 2004 21:59:01 -0400

Hi Keith,

Thanks for your help!

I tried adding an IPermission element for FileIOPermission, right under the
existing one in the wss_mediumtrust.config:
<IPermission
  class="FileIOPermission"
  version="1"
  Read="G:\SpecialDir"
  PathDiscovery="G:\SpecialDir"
/>
When I try to read g:\specialdir\test.txt, I receive the following error:
The HelloWorldApp, Version=1.0.0.1, Culture=neutral,
PublicKeyToken=dc2757a2b56c5017 assembly specified in a Register directive
of this page could not be found

Any suggestions?

Eric

"Keith Brown" <Keith Brown@discussions.microsoft.com> wrote in message
news:7CB11EAB-D2CE-4306-8BC2-2208083725C2@microsoft.com...
> Hey Eric,
>
> You definitely do NOT want to make the SecurityPermission unrestricted.
That has no effect at all on the FileIOPermission, which is what you really
want to fix, but what it does do is grant all *sorts* of scary permissions
(like ControlPolicy, which allows you to set
SecurityManager.SecurityEnabled=false and turn off all of CAS!)
>
> You have a couple of choices: you can either move your functionality into
an assembly in the GAC (where it will be fully trusted) and mark your
assembly with the AllowPartiallyTrustedCallers attribute, or you can change
policy like you were suggesting by adding an element for FileIOPermission,
either making it unrestricted or (even better) specifying the exact
directory and permission level you need to grant.
>
> Keith Brown, MVP
> http://www.pluralsight.com