I'm trying to code an app that save parameters in C:\Program(x86). But I'm not allowed to write/read on this folder that is why I have an error message
My app works perfectly when I change the installation folder (not in C:). If i do understand it is linked to my access rights.
DirectoryInfo dir_mainfold;
private void main_fold()
{
try
{
if (File.Exists(".\\Configuration\\main_fold.txt"))
{
string[] sConf = File.ReadAllLines(".\\Configuration\\main_fold.txt");
dir_mainfold = new DirectoryInfo(sConf[0]);
textBox7.Text = dir_mainfold.ToString();
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message + " " + ex.StackTrace);
}
}
I want it to delete the file if it exists, and create it/ write the content of my textbox on it if not.