AppData\Roaming folder in windows service project

Posted by vikash on Stack Overflow See other posts from Stack Overflow or by vikash
Published on 2011-11-25T19:55:49Z Indexed on 2011/11/27 9:50 UTC
Read the original article Hit count: 285

Filed under:
|

I need a help on getting Special folder in windows service program. I used this code in my Windows Form application:

Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);

and got the path, ""C:\Users\\AppData\Roaming"*

But if I run the same code in my Winows Service project I got the path: "C:\Windows\ServiceProfiles\LocalService\AppData\Roaming\"

But I need the earlier path (got in Windows Form). How do I get the same path in Service projet also.

I have user setting file, log, config file in the "C:\Users\\AppData\Roaming" folder. So I have to refer the same path both in my Windows Form application and Windows Service project.

Can somebody tell me, what is the difference here and how do i get the same path in both type of project?

Thanks, sharath

© Stack Overflow or respective owner

Related posts about Windows

Related posts about windows-services