c# - Environment.GetFolderPath returns null in WMI provider -


i have decoupled wmi provider (windows service) configured file lives in c:\programdata\companyname folder. when service loads uses environment.getfolderpath(enviornment.specialfolder.commonapplicationdata) method grab c:\programdata portion of path.

while service running attempt write same file, through wmi call service, using same method call time fails; returning null.

is there fact i'm running in context of wmi causes happen?

i have been having same problems, perhaps can offer solution. different usage attempting special folders on web server write temporary files indeed having issues user runs (runs under defualtapppool domain group rather user even)

had blanks returned on local win 7 machine attempts get

 environment.getfolderpath(environment.specialfolder.applicationdata); 

however did manage use appdomain.currentdomain.getdata method wanted, has several different options find different folders in file structure instead of being user based works based on application or suppose system. pretty sure "clean" method use environment.getfolderpath method

http://msdn.microsoft.com/en-us/library/system.appdomain.getdata.aspx

one of the enumerations bound achieve looking for.

appdomain.currentdomain.getdata("programfiles"); 

or @johnb

appdomain.currentdomain.getdata("startmenu"); 

Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -