title: Create directory and allow write access C# .NET Core
body: <p>I'm creating a directory and subsequently writing to a file in that directory, but I get permission denied. It's within my user folder.</p>
  
  <p><code>Directory.CreateDirectory(filename);</code></p>
  
  <pre><code>using (FileStream fs = File.Open(Path.Combine(filename, "t.pxp"), FileMode.OpenOrCreate)){...}
  </code></pre>
  
  <p>I've tried adding FileAccess.Write as a parameter to the File.Open but that's for the file itself.</p>
  
  <p><a href="https://msdn.microsoft.com/en-us/library/9h4z99zb(v=vs.110).aspx" rel="nofollow noreferrer">https://msdn.microsoft.com/en-us/library/9h4z99zb(v=vs.110).aspx</a>
  This is .NET Framework and doesn't work in .NET Core</p>
  
  <p>How do I add ACL write access? I can write to files no problem, but I can't create a directory and then create a file in that directory.</p>