Csharp/C Sharp by API/System.Security.Permissions/FileIOPermissionAttribute
mark FileIOPermissionAttribute
using System;
using System.IO;
using System.Security.Permissions;
[assembly:FileIOPermissionAttribute(SecurityAction.RequestMinimum, All=@"c:\\temp")]
public class MainClass
{
public static void Main()
{
FileStream fsOut = File.Create(@"c:\test.txt");
StreamWriter sw = new StreamWriter(fsOut);
sw.WriteLine("asdf.");
sw.Flush();
sw.Close();
}
}