title: "could not find a part of the path" DownloadFile
body: <p>I've a situation with a windows APP I'm developing where the DownloadFile is throwing an "could not find a part of the path" exception. </p>
  
  <p>The method I'm using to save a remote zip file to my hard drive looks like this:</p>
  
  <pre><code>    private void f_begin_download(string remoteURL)
      {
          string directoryName = System.IO.Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
          //MessageBox.Show(directoryName);
  
          filePath = directoryName + "\\tmp\\";
          filePath = f_make_directory(filePath);
  
          Uri remoteURI = new Uri(remoteURL);
          System.Net.WebClient downloader = new System.Net.WebClient();
  
          downloader.DownloadFileCompleted += new System.ComponentModel.AsyncCompletedEventHandler(f_downloader_DownloadFileCompleted);
          try
          {
              downloader.DownloadFile(remoteURI, filePath);
          }
          catch (Exception ex)
          {
              MessageBox.Show(remoteURI.ToString());
              MessageBox.Show(filePath);
              MessageBox.Show(ex.ToString());
          }
      }
  </code></pre>
  
  <p>This method actually creates the /tmp/ folder in my application directory. It does successfully create the folder too:</p>
  
  <pre><code>    public static string f_make_directory(string path)
      {
          try
          {
              System.IO.DirectoryInfo newFolder = new System.IO.DirectoryInfo(path);
              if (!newFolder.Exists)
              {
                  newFolder.Create();
              }
          }
          catch (Exception ex)
          {
              MessageBox.Show(ex.ToString());
          }
          return path;
      }
  </code></pre>
  
  <p>But when I run the process the exception looks like this:</p>
  
  <pre><code>System.Net.WebException: An exception occurred during a WebClient request. --&gt;     System.IO.DirectoryNotFoundException: Could not find a part of the path' C:\Users\Hudson Atwell\Desktop\The Big Test Folder\tmp\'. 
  at System.IO.__Error.WinIOError(Int32 errorCode,String maybeFullPath) 
  at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRight, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msyPath, Boolean bFromProxy, Boolean useLongPath) 
  at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access) at System.Net.WebClient.DownloadFile(Uri address, String fileName) 
  </code></pre>
  
  <p>at WindowsFormsApplication1.window_updater.f_begin_download(String remoteURL) in C:\Users\Hudson Atwell\Documents\Visual Studio\Projects\Test Project\Test Project]Windows\window_update.cs:line 125 </p>
  
  <p>I am requiring the solution to be ran as an administrator too. </p>
  
  <p>Any advice to what I'm doing wrong?</p>