title: Directory.CreateDirectory on a network path
body: <p>I'm trying to create a new directory tree on a network path.</p>
  
  <p>The share is located at <code>\\192.168.5.193\FileContext</code> and has <code>Everyone</code> <strong>full access</strong> permissions.</p>
  
  <p>This piece of code:</p>
  
  <pre><code>DirectoryInfo directoryInfo = Directory.
    CreateDirectory(@"\\192.168.5.193\FileContext\FileContext_Root\General\Test");
  </code></pre>
  
  <p>gives me:</p>
  
  <pre><code>An exception of type 'System.IO.IOException' occurred in mscorlib.dll
  but was not handled in user code
  
  Additional information: Logon failure: unknown user name or bad password.
  </code></pre>
  
  <p>If I try to open the same address with Windows Explorer, it opens up without password requirements.</p>
  
  <p>The <code>CreateDirectory()</code> documentation states it should accept UNC paths:</p>
  
  <blockquote>
    <p>You can create a directory on a remote computer, on a share that you have write access to. UNC paths are supported; for example, you can specify the following for path: \2009\Archives\December in Visual Basic, and \\2009\Archives\December in C#.</p>
  </blockquote>
  
  <p>It also states that <code>IOException</code>s could came from:</p>
  
  <blockquote>
    <p>The directory specified by path is a file .<br>
    -or-<br>
    The network name is not known.</p>
  </blockquote>
  
  <p><a href="https://msdn.microsoft.com/en-us/library/vstudio/54a0at6s(v=vs.100).aspx" rel="nofollow noreferrer">https://msdn.microsoft.com/en-us/library/vstudio/54a0at6s(v=vs.100).aspx</a></p>
  
  <p>How can I resolve?</p>