Reputation: 1337
I have an ASP.Net Core application, and for the current purposes I've got to use LocalAppData.
Usually I would write Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData)
, but unfortunately it's not working with ASP.Net Core.
Could anyone help me with this?
UPDATE
Thanks to Adem Caglin, I've found the solution.
The code I use:
Environment.GetEnvironmentVariable(
RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? "LocalAppData" : "Home");
Upvotes: 22
Views: 13186
Reputation: 528
Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData)
Upvotes: 6
Reputation: 24073
Try this:
Environment.GetEnvironmentVariable("LocalAppData");
ps: tested on windows
Upvotes: 17