Requesting a permission set : File Permission « File Directory Stream « C# / CSharp Tutorial






using System;
using System.IO;
using System.Security.Permissions;

[assembly:PermissionSetAttribute(SecurityAction.RequestMinimum,Name="FullTrust")]

class MainClass
{
  public static void Main() 
  {
    FileStream fsOut = File.Create(@"c:\\temp\\test.txt");
    StreamWriter sw = new StreamWriter(fsOut);
    sw.WriteLine("str");
    sw.Flush();
    sw.Close();
  }
}








15.12.File Permission
15.12.1.Requesting minimum permissions
15.12.2.Requesting optional permissions
15.12.3.Requesting a permission set
15.12.4.Refusing permissions
15.12.5.Demanding permissions
15.12.6.Permission sets
15.12.7.Declarative Permission demo