Demand FileIOPermissionAccess.AllAccess : File Security Permission « Windows « C# / C Sharp






Demand FileIOPermissionAccess.AllAccess

 

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Windows.Forms;
using System.Security;
using System.Security.Permissions;

public class MainClass {
    public static void Main() {
        try {
            FileIOPermission fileIOPermission = new FileIOPermission(FileIOPermissionAccess.AllAccess, @"c:\");
            fileIOPermission.Demand();
        } catch (SecurityException) {
            
        }
    }
}
           
         
  








Related examples in the same category

1.Use SecurityManager to check the FileIOPermissionAccess.Write
2.FileSecurity
3.FileSystemRights.Read
4.Open File In Explorer