title: System.UnauthorizedAccessException while creating file in app folder
body: <p>I have Winforms application that must create write to certain configuration file during usage. Once i use debug mode this file can be create and written to it but once i create Setup Project and actually install the application i cannot access with following exception.</p>
  
  <p>Configuration file is located the same directory as program ( at Program Files )</p>
  
  <p>Code i'm using to read/write is.</p>
  
  <pre><code>public static string[] GetDefaultConfigFile(string path)
  {
      string[] res = {};
      if (File.Exists(GetInternalFileName(path)))
      {
          using (StreamReader tr = new StreamReader(GetInternalFileName(path)))
          {
              res = tr.ReadToEnd().Split(';');
          }
      }
      return res;
  }
  
  public static void SaveDefaultConfigFile(string fileName, string path)
  {
      using (var tw = new StreamWriter(GetInternalFileName(path)))
      {
          tw.Write(fileName);
          tw.Close();
      }
  }
  
  private static string GetInternalFileName(string path)
  {
      return path + "\\setup.config";
  }
  </code></pre>