c# - The directory name <Path> is invalid | Impersonation | Windows Service -


I have a window service that is meant to track a file path and take some actions on files created later .

The place to monitor is a network location, which I am impersonating, has full access to it.

  LOGON32_LOGON_INTERACTIVE = 3; LOGON32_PROVIDER_DEFAULT = 0; String watchpath = @ "\\ servername \ folder \"; (New impersonator ("user name", "domain", "password")) ({PermissionSet (SecurityAction.Demand, Name = "FullTrust")) FSWatcher = New FileSystemWatcher (); FSWatcher.Path = Watchpath; \\ FSWatcher.NotifyFilter = NotifyFilters.LastAccess | NotifyFilters.LastWrite | NotifyFilters.FileName | NotifyFilters.DirectoryName; FSWatcher.Filter = "* .xls"; FSWatcher.Created + = New FileSystemEventHandler (On-Chandled); FSWatcher enabled RaisingEvents = true; FSWatcher.IncludeSubdirectories = false; }  

I am saying an error - "The name of the directory is invalid ..."

I have no indication what is happening to this error, because The network path is when I'm trying to access resources on another server, I'm able to access it.

Check this MSDN article:

The account that is running your code (not the impersonated account) should be configured to be able to delegate the credentials.


Comments

Popular posts from this blog

eclipse plugin - Run java code error: Workspace is closed -

ios - How do I use CFArrayRef in Swift? -

scala - Play Framework - how to bind form to a session field -