title: The directory name <Path> is invalid | Impersonation | Windows Service
body: <p>I have a windows service which is intended to monitor a File Path and later perform some actions on the files created.</p>
  
  <p>The location to be monitored is a network location on which the user I am impersonating has full access.</p>
  
  <pre><code>LOGON32_LOGON_INTERACTIVE = 3;
  LOGON32_PROVIDER_DEFAULT = 0;
  
  string watchPath = @"\\servername\Folder\";
  using (new Impersonator("UserName", "Domain", "Password"))
  {
    [PermissionSet(SecurityAction.Demand, Name = "FullTrust")]
    FSWatcher = new FileSystemWatcher(); 
    FSWatcher.Path = watchPath;  \\ POINT OF ERROR
    FSWatcher.NotifyFilter = NotifyFilters.LastAccess | NotifyFilters.LastWrite | NotifyFilters.FileName | NotifyFilters.DirectoryName;
  
    FSWatcher.Filter = "*.xls";
    FSWatcher.Created += new FileSystemEventHandler(OnChanged);
    FSWatcher.EnableRaisingEvents = true;
    FSWatcher.IncludeSubdirectories = false;
  }
  </code></pre>
  
  <p>I get an Error saying - "The directory name  is invalid"...</p>
  
  <p>I have no clue what is causing this error, since the network path is accessible when I access it using the credentials manually.</p>