Write in “ProgramData” folder (W7 and Vista) .NET

♀尐吖头ヾ 提交于 2019-11-29 03:23:48

This is a UAC thing. You have your program run as administrator for creating/deleting files/folders in this SpecialFolder.

An easy to understand explanation of the different places you can store program data can be found here:

http://blogs.msdn.com/cjacks/archive/2008/02/05/where-should-i-write-program-data-instead-of-program-files.aspx

As regards ProgramData, it says:

FOLDERID_ProgramData / System.Environment.SpecialFolder.CommonApplicationData The user would never want to browse here in Explorer, and settings changed here should affect every user on the machine. The default location is %systemdrive%\ProgramData, which is a hidden folder, on an installation of Windows Vista. You'll want to create your directory and set the ACLs you need at install time.

it is a conceptual issue at first look:

You should NOT use the "ProgramData" directory but some user specific files. Needed installation data should installed in the "program files" or in the registry.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!