Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
B

brian598

@brian598
About
Posts
2
Topics
0
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • change directory access control for common application data folder failed.
    B brian598

    Well, I thought it was working on Vista but I must have been running my client in admin mode because I can't get it to work again. What does work is creating an installer package for my windows service that creates the directory in ProgramData. Using vs.net 2008 I added a custom folder called Common Application Data Folder (any name will work). I set the DefaultLocation property to [CommonAppDataFolder] and the Property property to COMMONAPPDATAFOLDER. Then I added my own folders to this folder (Company\commondir). When the install is run it creates the folders and adds "Users" to the security properties for those folders. This seems to give "Users" enough permission to read/execute and write files to that location. My non-admin windows client can read/ write and execute from the folder and my windows service can as well.

    C# help

  • change directory access control for common application data folder failed.
    B brian598

    I do something very similar except use "Everyone" in the access rule: string appDataPath = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData); string _localUserDataPath = Path.Combine(appDataPath,"My Company\\MyApp\\"); if (!Directory.Exists(_localUserDataPath)) { DirectorySecurity ds = new DirectorySecurity(); ds.AddAccessRule(new FileSystemAccessRule("Everyone", FileSystemRights.FullControl, AccessControlType.Allow)); Directory.CreateDirectory(_localUserDataPath, ds); } else { // the directory exists - lets change security on it DirectoryInfo di = new DirectoryInfo(_localUserDataPath); DirectorySecurity ds = new System.Security.AccessControl.DirectorySecurity(); ds.AddAccessRule(new FileSystemAccessRule("Everyone", FileSystemRights.FullControl, AccessControlType.Allow)); di.SetAccessControl(ds); }

    C# help
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups