FileIOPermission exception on network folder GetFiles

CodyB

Active member
Joined
Jul 23, 2007
Messages
26
Programming Experience
3-5
I am using GetFiles to list all the files in a directory.
If the directory is local, my program works fine.
If the directory is on a network I get:
"Request for the permission of type 'System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed."
I can use Windows explorer to completely manipulate the folder and the files any way I want.
I am assuming I have to code this permission in, but I can't find any references as to how to do it.
 
Eureka, I found the answer!

I had to goto "Project\Properties\Security" and set it as a "Full Trust Application".
 
Hi, The security settings of the framework can take awhile to get your head round.

Setting your application to 'Full Trust' only applies to the ZONE that the Code Access is running from. If the Framework Policies for that ZONE are different from where your appliction is deployed this assembley won't run.

This can be changed using Microsoft .NET Framework Configuration tools.

Paul
 
I think Isee what you mean.
When i run this application from the network location I can't use it to execute a .exe file on the C:\
I ended up moving this application to the C:\ drive and then I could execute the other .exe
 
Back
Top