I am working with a desktop application and i have created the setup of the application by visual studio setup & deployment project, i am facing issue, i am unable to write the data into my sqlite file because of write permission. During executing the application i am getting error, "You are writing read-only database".
My question is how can i give the write permission to the file under "CommonApplicationData" so it must be accessible from all the users of the same system.
i tried following way to give permission during writing the file.
System.IO.Directory.CreateDirectory(thisApp.app_rootFolder);
DirectoryInfo myDirectoryInfo = new DirectoryInfo(thisApp.app_rootFolder);
DirectorySecurity myDirectorySecurity = myDirectoryInfo.GetAccessControl();
myDirectorySecurity.AddAccessRule(new FileSystemAccessRule("ashish", FileSystemRights.Read | FileSystemRights.Write | FileSystemRights.Modify, AccessControlType.Allow));
myDirectoryInfo.SetAccessControl(myDirectorySecurity);
my file location is like:
C:\ProgramData\Forlagshuset\priceChecker\myAppDb.sqlite
I am able to write data from the "Guest" account of my system because "Guest" has write permission but i am unable to write from my user because of Read only permission.
is there any mechanism which provide write permission to the file for all users within system ?
Aucun commentaire:
Enregistrer un commentaire