I need to create a file in the path c:/Progran File (x86). But it throws a error saying access denied. I have tried the below code, but it didn't help.
   private bool GrantAccess(string fullPath)
   {
      DirectoryInfo dInfo = new DirectoryInfo(fullPath);
      DirectorySecurity dSecurity = dInfo.GetAccessControl();
      dSecurity.AddAccessRule(new FileSystemAccessRule(new SecurityIdentifier(WellKnownSidType.WorldSid, null), FileSystemRights.FullControl, InheritanceFlags.ObjectInherit | InheritanceFlags.ContainerInherit, PropagationFlags.NoPropagateInherit, AccessControlType.Allow));
      dInfo.SetAccessControl(dSecurity);
      return true;
   }       
 
    