AppData\Roaming folder in windows service project
- by vikash
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