Re: Strange problem with FileIOPermission

From: Nicole Calinoiu (nicolec_at_somewhere.com)
Date: 08/31/04


Date: Tue, 31 Aug 2004 11:39:32 -0400

When is the SecurityException thrown? When your forms assembly loads? When
a particular line of code is run (and if so, what's the line)?

"Shell" <shelld00d@yahoo.com> wrote in message
news:ch14mv$a72@odbk17.prod.google.com...
> Hi,
>
> I have a problem with the FileIOPermission attribute. Here's my
> situation:
>
> I've written a class in whose AssemblyInfo I've added the line
>
> [assembly: FileIOPermission(SecurityAction.RequestRefuse, All =
> @"c:\myOtherFolder")]
>
> I added the same line to the AssemblyInfo of a WinForms application.
>
>>>From what I figure, this means that both my class and forms app are
> requesting no access to 'myOtherFolder'. I checked with permview and it
> confirms that all access to these folders have been refused.
>
> Now the problem... when I run my app and instantiate the class, a
> security exception gets thrown:
>
> An unhandled exception of type 'System.Security.SecurityException'
> occurred in system.windows.forms.dll
>
> Additional information: Security error.
>
>
> It goes away if:
>
> a) I remove the line from my winforms assemblyinfo.cs, or
> b) I change RequestRefuse to RequestMinimum in my class.
>
> I can't seem to make sense of this. Any comments?
>
> [Disclaimer: This is my first step into CAS. Please forgive my
> ignorance. :)]
>



Relevant Pages

  • RE: Newbie Question: Security Exception With Data Access
    ... This error is just .NET stack walking with SharePoint - no need to worry, ... The recommended approach (for security reasons) is to: ... Add the 'AllowPartiallyTrustedCallers' attribute to your assemblyinfo ... To grant this application the required permission ...
    (microsoft.public.sharepoint.portalserver.development)
  • Re: accessing database from webpart
    ... The security errors is just .NET stack walking with SharePoint - no need to ... Add the 'AllowPartiallyTrustedCallers' attribute to your assemblyinfo ... > can u please tell what kind of security settings. ...
    (microsoft.public.sharepoint.portalserver.development)