Is there a way to create folders in wwwroot when the application startup?
Perhaps in the startup.cs class?
I know how to create folders in wwwroot in controller action methods. I do not want this.
This is what I would like:
- I have a List of Objects:
List<Organization> Organizations foreach (Organization in Organization)I want a folder with theOrganization.Namecreated in thewwwrootfolder- I would like it to be created at the moment the application is launched
Thanks in advance you for any help
To achieve the requirement, you can try to inject
IHostApplicationLifetimeintoConfigure()method and write the callback forApplicationStarted, then you can create folder(s) based onList<Organization> Organizations.