I have had the same problem. When calling the system.io.directory.getfiles
with a file that is on a network or out of the scope of the executable then
you may get the error you described due to trusted assemblies. The runtime
security policy for the assembly may not have the correct permissions to
utilize the file that your program is trying to use. I was having a hard
time getting my code to execute properly from a network on various other
machines due to the difference in some users security policies for certain
domains located under the .net configuration in the control panel. It is
possible to configure everyone's runtime policy at login by deploying an
.msi file and that may fix your problem.
There are allot of trust options for managed code and I found it difficult
to find a work around without changing anyone's security settings to get it
to work. The work around that I used was to make sure that anyone who uses
one of my executables or dll files will have to first save it to their
computer. As long as everyone has the normal security settings to execute
code and read and write files within there own computer.
I wish I could be of more help but I am very new to .net and I have just
gone through the same issue you may be having. I did allot of GIS on the
subject and found that it is a topic that is hard to get help on. I have
also learned how powerful the managed assembly is when used in a trusted
environment. My guess is that it will inevitable lead to .net permission
nazi's (from power vacuum admins) and make software development even more
difficult to share, sell and configure.
--
CB
wrote in message news:5263393@discussion.autodesk.com...
Hi,
I have a C# dll loaded in Autocad 2007 that calls
System.IO.Directory.GetFiles(path, searchPattern).
It works fine on my development machine. It fails on the user's computer
even though he has administrator right.
"Request for the permission of type
'System.Security.Permissions.FileIOPermission...' Failed"
So I made him try a test .exe application that calls
Directory.GetFiles(path, searchPattern) and it works on his computer.
I understand that my dll is in a hosted environment so is there any setting
that I must do on the end user machine or in my code to be able to call code
that access the file IO ?
Thank you !
Message was edited by: PierreQC