In Umbraco 8 can inject the IUmbracoSettingsSection type via dependency injection:
using Umbraco.Core.Configuration.UmbracoSettings;
public class MyClass {
private readonly IUmbracoSettingsSection _umbracoSettings;
public MyClass(IUmbracoSettingsSection umbracoSettings) {
_umbracoSettings = umbracoSettings;
}
}
Reading strongly-typed values from umbracoSettings.config
Hello,
is there a way to access the settings information of Umbraco 8 umbracoSettings.config file in a strongly-typed way?
For the task at hands, I need to get to the imaging->imageFileTypes value.
Kind regards! Mikael
Hi Mikael
In Umbraco 8 can inject the
IUmbracoSettingsSection
type via dependency injection:Or alternatively via
Current
:Also if you're looking to do the same in Umbraco 9, it can be done as:
is working on a reply...