title: C# Unauthorized Access Exception
body: <p>I'm getting an Unauthorized Access Exception when I'm trying to open the file</p>
  
  <pre><code> public Form1()
      {
          InitializeComponent();
      }
  
      private void button1_Click(object sender, EventArgs e)
      {
          short numberOfLines = Int16.Parse(textBox1.Text);
          webBrowser = new WebBrowser[numberOfLines];
          if (!Directory.Exists(logPath))
          {
              System.IO.Directory.CreateDirectory(logPath);
          }
          for (short i = 0; i &lt; numberOfLines; i++)
          {
              System.IO.StreamWriter file = new System.IO.StreamWriter(logPath);
              runBrowserThread(i);
          }
      }  
  </code></pre>
  
  <p>it says, the access to the path was denied. Where may be the issue?</p>