In previous versions of EPiServer, the EPiServer specific settings were located under the AppSettings block in the Web.Config file. These have been removed. Instead of using the AppSettings collection EPiServer settings are today accessed through the use of a configuration class. All settings are typed members of this class which gives the added benefit of being able to access all settings through intellisense.

The class responsible for serving site settings is EPiServer.Configuration.Settings.Instance, defined as:

CopyC#
public static Settings Instance

To locate the settings for a specific site in Web.Config, scroll down to the <EPiServer> section and find the <sites> element collection. Accessing the settings through the use of the Instance property will list settings for the current site.

Following is a sample of how to read and present site settings by using EPiServer.Configuration.Settings.Instance.

Code-behind in SettingsPage.aspx.cs

CopyC#
using System;
using System.Text;
using System.Collections.Generic;
using System.Reflection;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using EPiServer;
using EPiServer.Core;
using EPiServer.DataAbstraction;
using EPiServer.Web.WebControls;

using EPiServer.Configuration;

namespace CodeSamples
{
    public partial class SettingsPage : EPiServer.TemplatePage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            lblWasteBasket.Text = Settings.Instance.PageWastebasketId.ToString();
            lblSiteURL.Text = Settings.Instance.SiteUrl.ToString();
            lblUIUrl.Text = Settings.Instance.UIUrl.ToString();

            // To read custom settings from the <appSettings> block in web.config
            // use code similar to:
            string customSetting = System.Web.Configuration.WebConfigurationManager.AppSettings["myCustomSetting"];
        }
    }
}

Markup, in SettingsPage.aspx

Copy 
<%@ Page language="c#" Inherits="CodeSamples.SettingsPage" Codebehind="SiteSettingsSamples.aspx.cs" %>

<html xmlns="http://www.w3.org/1999/xhtml">
    <head />
    <body>
        <table cellspacing="4" border="1">
            <tr>
                <td>WasteBasket ID</td>
                <td><asp:label id="lblWasteBasket"  runat="server" text="Label" /></td>
            </tr>
            <tr>
                <td>The URL of the site</td>
                <td><asp:label id="lblSiteURL"  runat="server" text="Label" /></td>
            </tr>
            <tr>
                <td>The UI URL</td>
                <td><asp:Label id="lblUIUrl" runat="server" /></td>
            </tr>
        </table>
    </body>
</html>

The output from this code should resemble the following: