I have an application that reads a license file when it starts. My installation creates a folder in the Program Files for the application, creates a folder with a license and places the license file there. However, when I try to run the application, it needs to read / update the license file. When I try to do this, I get an "unauthorized access exception". I am registered as an administrator and I run the program manually.
Any idea why I cannot access this file, even if the path is correct? But in the installation, it creates a file and a folder just fine?
I have MyApplication.exe, and my license reader is in a separate DLL called MyApplicationTools. I read / write the license file as follows:
//Read StreamReader reader = new StreamReader(path + "license.lic"); //Write StreamWriter writer2 = new StreamWriter(path + "License.lic"); string str = Convert.ToBase64String(sharedkey.Key); writer2.WriteLine(str); writer2.Close();
thanks
source share