File Directory ASP.Net Tutorial

<%@ Page Language="C#" %>
<%@ Import Namespace="System.IO" %>


    protected void Page_Load(object sender, EventArgs e)
    {
        System.Security.AccessControl.FileSecurity sec =
         System.IO.File.GetAccessControl(Server.MapPath("Data.txt"));
        sec.AddAccessRule(
                 new System.Security.AccessControl.FileSystemAccessRule(
                          @"DEMOXP\TestUser",
                          System.Security.AccessControl.FileSystemRights.FullControl,
                          System.Security.AccessControl.AccessControlType.Allow
                          )
                 );
        File.SetAccessControl(Server.MapPath("TextFile.txt"), sec);
    }



    Untitled Page