I am using a program created in Visual Studio / Windows Forms. In it, access the following file to get some information:
1st Code (works normal)
StreamReader file = new StreamReader(@ "E:\OneDrive\VisualStudio\codigosAIH\codigosAIH\bin\Debug\tb_cid.txt", Encoding.GetEncoding("iso-8859-1"));
I changed the code so that the program looks for the file in the installation folder:
2nd Code (give access error denied)
StreamReader file = new StreamReader(Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory.ToString() + @"\tb_cid.txt"), Encoding.GetEncoding("iso-8859-1"));
Doing so, I get the Path Access error was denied. I have already used a MessageBox to confirm the path and it is correct.
I do not think it's a permission problem, otherwise I would not be able to access the form of the first code.
What can it be?