Click here to Skip to main content
15,895,667 members
Home / Discussions / C#
   

C#

 
GeneralRe: Really no way to free an object ? Pin
Andres Coder5-Feb-04 9:45
Andres Coder5-Feb-04 9:45 
GeneralRe: Really no way to free an object ? Pin
scadaguy5-Feb-04 13:56
scadaguy5-Feb-04 13:56 
GeneralCan't call a method with parameters when opening a thread Pin
Peter Mills5-Feb-04 7:27
Peter Mills5-Feb-04 7:27 
GeneralRe: Can't call a method with parameters when opening a thread Pin
Bill Dean5-Feb-04 8:39
Bill Dean5-Feb-04 8:39 
GeneralRe: Can't call a method with parameters when opening a thread Pin
boogs5-Feb-04 8:42
boogs5-Feb-04 8:42 
GeneralRe: Can't call a method with parameters when opening a thread Pin
Heath Stewart5-Feb-04 18:04
protectorHeath Stewart5-Feb-04 18:04 
GeneralRe: Can't call a method with parameters when opening a thread Pin
Peter Mills7-Feb-04 14:26
Peter Mills7-Feb-04 14:26 
Generalremoving registry garbages Pin
Shahin775-Feb-04 6:23
Shahin775-Feb-04 6:23 
GeneralRe: removing registry garbages Pin
Heath Stewart5-Feb-04 6:38
protectorHeath Stewart5-Feb-04 6:38 
GeneralJava vs. C# means file watcher problems Pin
RB@Emphasys5-Feb-04 6:22
RB@Emphasys5-Feb-04 6:22 
GeneralRe: Java vs. C# means file watcher problems Pin
Heath Stewart5-Feb-04 6:47
protectorHeath Stewart5-Feb-04 6:47 
GeneralRe: Java vs. C# means file watcher problems Pin
RB@Emphasys5-Feb-04 7:08
RB@Emphasys5-Feb-04 7:08 
GeneralWeb Service error Pin
Peter Greenall5-Feb-04 5:55
Peter Greenall5-Feb-04 5:55 
GeneralImpersonation and FileSystemWatcher (threading?) Pin
Bill Dean5-Feb-04 5:47
Bill Dean5-Feb-04 5:47 
GeneralRe: Impersonation and FileSystemWatcher (threading?) Pin
John Fisher5-Feb-04 6:00
John Fisher5-Feb-04 6:00 
GeneralRe: Impersonation and FileSystemWatcher (threading?) Pin
Bill Dean5-Feb-04 6:08
Bill Dean5-Feb-04 6:08 
GeneralRe: Impersonation and FileSystemWatcher (threading?) Pin
Heath Stewart5-Feb-04 6:29
protectorHeath Stewart5-Feb-04 6:29 
The FileSystemWatcher runs in another thread, yes. How do you think you can set Enabled to true and continue your code?

Before you do set Enabled, you should get the impersonated IIdentity, wrap that in an IPrincipal implementation (such as WindowsPrincipal) and pass that to AppDomain.SetThreadPrincipal in order to set the principal for new threads created in this AppDomain.

Another idea to solve this problem is to - if possible - create an account in your domain specifically for this service, much like many database admins do for SQL Server. Then you can grant this user permission to whatever directories you need watched and exclude it from those that don't (just be sure to handle exceptions properly when access is denied).

 

Microsoft MVP, Visual C#
My Articles
GeneralRe: Impersonation and FileSystemWatcher (threading?) Pin
Bill Dean5-Feb-04 6:54
Bill Dean5-Feb-04 6:54 
GeneralRe: Impersonation and FileSystemWatcher (threading?) Pin
Heath Stewart5-Feb-04 8:51
protectorHeath Stewart5-Feb-04 8:51 
GeneralRe: Impersonation and FileSystemWatcher (threading?) Pin
Bill Dean5-Feb-04 9:26
Bill Dean5-Feb-04 9:26 
GeneralRe: Impersonation and FileSystemWatcher (threading?) Pin
Bill Dean5-Feb-04 16:00
Bill Dean5-Feb-04 16:00 
GeneralComboBox in Grid Pin
H r M5-Feb-04 5:03
H r M5-Feb-04 5:03 
GeneralRe: ComboBox in Grid Pin
John Fisher5-Feb-04 5:29
John Fisher5-Feb-04 5:29 
GeneralObtaining VBA stored BLOB Values from a Database Pin
Paul Kennedy5-Feb-04 5:01
Paul Kennedy5-Feb-04 5:01 
GeneralRe: Obtaining VBA stored BLOB Values from a Database Pin
John Fisher5-Feb-04 5:40
John Fisher5-Feb-04 5:40 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.