title: File Access Denied
body: <p>I am using an FTPClient library to transfer files from a Windows share to an FTP server.</p>
  
  <p>The SendFile method of the library uses the following code:</p>
  
  <pre><code>FileStream stream = new FileStream(localFileName, FileMode.Open);
  </code></pre>
  
  <p>This results in a System.UnauthorizedAccessException being thrown, however I am able to open, rename, and move the file using Windows Explorer under the same user account which the code is being executed.</p>
  
  <p>Can anyone tell me why this is happening?</p>
  
  <p><strong>Edit:</strong></p>
  
  <p>The strange thing is that I can access other files on the share which have been granted the same NTFS permissions as the one that I can't.</p>
  
  <p>This is also a Windows forms app.</p>
  
  <p><strong>Update:</strong></p>
  
  <p>Still no luck with this. I am able to read the file using a <code>StreamReader</code> but not a file stream. I can't understand why the two behave differently.</p>