Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Path to LocalAppData in ASP.Net Core application

Tags:

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");

like image 775
Dmitry Volkov Avatar asked Aug 30 '16 10:08

Dmitry Volkov


1 Answers

Try this:

Environment.GetEnvironmentVariable("LocalAppData");

ps: tested on windows

like image 113
adem caglin Avatar answered Sep 29 '22 21:09

adem caglin