Re: Strange problem with FileIOPermission
From: Nicole Calinoiu (nicolec_at_somewhere.com)
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" <email@example.com> wrote in message
> I have a problem with the FileIOPermission attribute. Here's my
> I've written a class in whose AssemblyInfo I've added the line
> [assembly: FileIOPermission(SecurityAction.RequestRefuse, All =
> 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. :)]