Re: .NET Security

Tech-Archive recommends: Fix windows errors by optimizing your registry




"GMiller" <lucerotech@xxxxxxxxx> wrote in message
news:1175107332.004322.134650@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
I am fairly new to .NET programming so this may be a simplistic
question. I wrote a C# application that reads and writes files. If
the program resides on a local drive everything is fine. If the
program resides on a network drive then I get the following error.

System.Security.SecurityException: Request for the permission of type
'System.Security.Permissions.FileIOPermission, mscorlib,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
failed.
at System.Security.CodeAccessSecurityEngine.Check(Object demand,
StackCrawlMark& stackMark, Boolean isPermSet)
at System.Security.CodeAccessPermission.Demand()
at System.IO.Directory.GetCurrentDirectory()
at Transmitter.TransmProcess.GetFiles(Form1 oTWin, String sDirPath)
The action that failed was:
Demand
The type of the first permission that failed was:
System.Security.Permissions.FileIOPermission
The Zone of the assembly that failed was:
Intranet

I have tried the following with no luck. Any suggestions?
FileIOPermission f = new
FileIOPermission(PermissionState.Unrestricted);
f.AllFiles = FileIOPermissionAccess.AllAccess;

%windir%\Microsoft.Net\Framework\v2.0.50727\caspol -cg 1.2 FullTrust will
allow "intranet" applications to run. Note that referencing an IP address
will make this an "internet" zone so use UNC. IE7 can also change the
interpretation of "intranet" so Tools / Options / Security and add server
name to Local Intranet if necessary.

PS


.