Reputation: 11362
I'm trying to build a site using Umbraco 6, for which I need to be able to restrict access to some Media content.
The approach I have come around to ( after a lot of trial and error ) is to create a custom MediaFileSystem replacement in which I will post media content of restricted types to a different, out of context, directory. From there I hope to be able to retrieve them with a permissions checked controller.
If this was a normal MVC site this would be a trivial task ( indeed, I rather suspect that using Umbraco in this case has added days of development time as I try to understand it's complexities and spend hours at a stretch wandering through documentation that is largely out of date ) but I can't for the life of me figure out how I am supposed to read configuration properties from umbracoSettings.config
in my own code. The Umbraco.Core.Configuration
library includes an UmbracoSettings
class to contain the data, but it's internal and I can't find any kind of developer-accessible alternative.
Is there a "correct" way to go through Umbraco and retrieve this data somehow? If not do I need to roll my own configuration reader to pick up any data that I need from these files adapt code from the existing source library regardless of the fact it is apparently deprecated?
Upvotes: 2
Views: 760
Reputation: 587
It's all a little confusing with namespaces in v6 - but if you reference umbraco.dll you can read the settings from the class UmbracoSettings
e.g. umbraco.UmbracoSettings.UmbracoLibraryCacheDuration gives the value stored for UmbracoLibraryCacheDuration in the UmbracoSettings.config file
Upvotes: 1