File Permission Problem in Windows 7
My program is appending to a log file in the common application data folder:
StreamWriter tw = new StreamWriter(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "me.log"), append, System.Text.Encoding.UTF8);
...
On Windows XP this worked fine - one user ran the program and it writes to the log, another user runs it and it does the same - no problems. On Windows 7 however, the first user forces creation of the file but sets permissions on it which excludes the "Users" set - write access is only given to Administrators and the person that ran it. Another user running the program gets file permission errors when hitting this bit of code.
Question is, how can I set file permissions on the file when it is first created so that it is open to other users ?