Needing access to site settings is definitely not a new challenge. I've been creating .NET CMS solutions for over ten years now and from my first project up until my most recent, every site has needed one. If you are new to CM development then think of these settings as things like the Search page Url, the contact us page or the check out page for a commerce site. Over the years, I've used a variety of ways to add settings into an EPiServer site. This article will discuss the benefits of some of the more popular methods.
Storing them in the StartPageThis one is one of the most common approaches. You create a new tab called setting on your home/start page and add everything in there. Using this approach is very easy as you can access the StartPage using ContentReference.StartPage. For access wise this is pretty easy, however, on some projects the amount of settings can bloat very quickly. When you use the StartPage on a high load site, loading up all this unneeded settings data and, from the other side, passing around the unneeded start page settings, adds more unneeded bandwidth on your server.
Creating a Setting Page TypeThis is also another one of the more popular choices. You create a SettingsPageType and define everything you need in it. The setting page can leave under the root page and you can easily get access to it using:
var repository = ServiceLocator.Current.GetInstance<IContentLocator>(); var settingPage = repository .GetChildren<SettingsPageType>(ContentReference.RootPage);Doing it this way means you don't have any unwanted data in your start page and you don't have any unneeded homepage data being passed around when you only care about settings. In 9 out of 10 cases, this is the approach I use now. It also means you can block access CMS editor pages. Some of the other benefits include version history and language management.