Demanding permissions : File Permission : File Directory Stream C# Examples


C# Examples » File Directory Stream » File Permission »

 

Demanding permissions









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

[FileIOPermissionAttribute(SecurityAction.Demand,All=@"c:\\temp")]
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();
    }
}
    
   
  
   




HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo File Directory Stream
» File Permission