简体   繁体   English

任何用户/管理员都可以具有读/写访问权限的系统位置

[英]System location where any User/Administrator can have read/write access permission

I have a wpf application. 我有一个WPF应用程序。 It uses SQL CE database. 它使用SQL CE数据库。

I am creating sdf file in user specific AppData folder. 我在用户特定的AppData文件夹中创建sdf文件。 But for individual application this will create individual sdf file's. 但是对于单个应用程序,这将创建单个sdf文件。

I don't want this thing. 我不要这个东西 I just want a common database location in which any user/administrator can have read/write access permission. 我只想要一个公共的数据库位置,任何用户/管理员都可以在其中拥有读/写访问权限。

Which location is preferred for such scenario? 在这种情况下,首选哪个位置?

Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData)

This gives you the root folder where all app data is shared. 这为您提供了共享所有应用程序数据的根文件夹。 Create a subfolder here for your app and store the file there. 在此处为您的应用创建子文件夹,并将文件存储在此处。

Unfortunately the common place only available and everyone will suggest is systems ProgramData directory. 不幸的是,仅有的一个普遍的地方,每个人都会建议是系统的ProgramData目录。 which is normally located under "C:\\ProgramData" on vista and seven . 通常位于vista7的 “ C:\\ ProgramData”下

and for XP it is "C:\\Documents and Settings\\All Users\\Application Data" 对于XP,它是“ C:\\ Documents and Settings \\ All Users \\ Application Data”

If your application runs under administrative mode then there is no need of read/write access permission. 如果您的应用程序在管理模式下运行,则不需要读/写访问权限。

But if you have planned to run the application under Standard account then you may need write permission. 但是,如果您计划以标准帐户运行该应用程序,则可能需要写权限。 but it depends on System UAC. 但这取决于系统UAC。

So it is suggested to create a folder for your db under ProgramData, put your db there which suppose to use by all other app from different user and grant write/modify access permission to this folder for all users. 因此,建议在ProgramData下为您的数据库创建一个文件夹,将您的数据库放置在此位置,以供其他用户的所有其他应用程序使用,并为所有用户授予对该文件夹的写入/修改访问权限。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 有什么办法以系统用户/管理员身份运行可执行文件? - Any way to run an executable as a system user / administrator? 在受限用户帐户XP中运行时,C#应用程序无法读取/写入管理员创建的文件 - C# Application can't read/write to files created by administrator when run in limited user account XP 如果用户不是管理员,则我的程序可以使用的临时目录在哪里? - Where is a temp directory that my program can use if the user is not an administrator? 以管理员身份运行:访问用户VirtualStore - Running as administrator: access user VirtualStore 任务正在运行,使用SYSTEM还是Administrator用户? - Task running-use SYSTEM or Administrator user? 我的c#应用程序应该在哪里写入数据,以便用户无法修改或访问它 - Where should my c# application write data so that the user can not modify or access it 您是否可以拥有一个从只有用户级别权限的客户端应用程序链接的具有管理员权限的 DLL? - Can you have a DLL with administrator privileges that is linked from a client application with only user level privileges? C#在没有管理员权限的情况下创建用户ODBC - C# create User ODBC without administrator permission 未经读取权限写入文件 - Write to a file without read permission C# 可以写入但不能读取任何串行数据 - C# Can Write But Can't Read Any Serial Data
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM