public static void ProvideFullAccess(string folder) { // In vista this does not work as we need to get the SeSecurityPrivilege access. In the meantime // we have to ignore this in case of any exception try { System.Security.AccessControl.DirectorySecurity sec = Directory.GetAccessControl(folder); sec.SetSecurityDescriptorSddlForm("D:PAI(A;OICI;FA;;;WD)"); // Gives full access to all the files in this folder Directory.SetAccessControl(folder, sec); } catch { } }