Web deploy and folder permissions (edit)

  • Web Deployment: Setting Folder Permissions
  • Web deploy and folder permissions
  • Setting folder permissions using Web Deploy
  • Set write permission to folders during webdeploy
  • Set Write Permission To Folders During Webdeploy
  • Configuring Web Deploy IIS User premissions

appcmd - @manhng

Xcopy + Appcmd + Cacls + iCacls - @manhng

Give specific local Windows user group full control access to a folder and its sub folders (IIS_IUSRS + IUSR) - @manhng

Windows 10 & Visual Studio 2019 Tools - @manhng

using System.IO;
using System.Security.AccessControl;

namespace GiveFullPermissions
{
    internal class Program
    {
        private static void Main(string[] args)
        {
            string path = @"C:\inetpub\wwwroot\MyAspNetWebApplication";

            DirectoryInfo directoryInfo = new DirectoryInfo(path);
            DirectorySecurity directorySecurity = directoryInfo.GetAccessControl();

            //var groupName_IIS_IUSRS = System.Environment.MachineName + @"\IIS_IUSRS";
            var groupName = @".\IIS_IUSRS";

            directorySecurity.AddAccessRule(
            new FileSystemAccessRule(groupName,
            FileSystemRights.FullControl,
            InheritanceFlags.ContainerInherit | InheritanceFlags.ObjectInherit,
            PropagationFlags.None,
            AccessControlType.Allow));

            directoryInfo.SetAccessControl(directorySecurity);

            System.Console.WriteLine("Done");
        }
    }
}