Holds the instances of all Site Settings configurations which are in the WebConfig file Source included

Namespace:  EPiServer.Configuration
Assembly:  EPiServer.Configuration (in EPiServer.Configuration.dll) Version: 5.2.375.236

Syntax

C#
public class Settings : ConfigurationElementBase

Remarks

The Settings class contains information about site settings configuration . This includes the current instance of site settings configuration via (Instance) and all sites settings configuration via (ALL)

Settings class has the falback Host which is indicates with "*" in the WebConfig file for an enterprise solution.

CopyC#
#region Copyright � 1997-2008 EPiServer AB. All Rights Reserved.
/*
This code may only be used according to the EPiServer License Agreement.
The use of this code outside the EPiServer environment, in whole or in
parts, is forbidden without prior written permission from EPiServer AB.

EPiServer is a registered trademark of EPiServer AB. For more information 
see http://www.episerver.com/license or request a copy of the EPiServer 
License Agreement by sending an email to info@episerver.com*/

#endregion

using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Configuration;
using System.Drawing;
using System.IO;
using System.Net.Mail;
using System.Reflection;
using System.Text;
using System.Text.RegularExpressions;
using System.Web;
using System.Web.Configuration;
using System.Web.Security;
using System.Web.UI;

namespace EPiServer.Configuration
{
    /// <summary>
    /// Holds the instances of all Site Settings configurations which are in the WebConfig file
    /// <img src="Icons/CSharp.gif" alt="Source included" border="0"/>
    /// </summary>
    /// <remarks>
    ///     <para>
    /// The <b>Settings</b> class contains information about site settings configuration . This includes the
    /// current instance of site settings configuration via (<b>Instance</b>) and all sites settings configuration via (<b>ALL</b>)
    /// </para>
    ///     <para>
    ///         <b>Settings</b> class has the falback Host which is indicates with "*" in the WebConfig file for an enterprise solution.
    /// </para>
    ///     <code source="../EPiServer.Configuration/Settings.cs" lang="cs"/>
    /// </remarks>
    public class Settings : ConfigurationElementBase
    {
        // Indicates the fallback host/site
        private const string _fallbackHost = "*";
        // Reference to the current site settings.
        private static Settings _instance;
        // Reference to all site settings. Key is siteId and key is Site Settings
        private static IDictionary<String, Settings> _all;
        // Reference to all site settings. Key is hostName and key is Site Settings
        private static IDictionary<string, Settings> _hostToSettings;
        // Reference to the parent EPiServer.Configuration.SiteElement
        private SiteElement _parent;
        // Reference to the siteUrl
        private Uri _cachedSiteUrl;

        #region Regexp definitions

        //Allows all characters specified as valid pchar characters in http://www.ietf.org/rfc/rfc2396.txt EXCEPT for escape sequences.
        //Simplified definition for pchar minus escape sequences:
        //[ alphanum | "-" | "_" | "." | "!" | "~" | "*" | "'" | "(" | ")" ":" | "@" | "&" | "=" | "+" | "$" | "," ]
        private const string _validVirtualPathCharactersRegex = @"[a-zA-Z0-9\-_\.!\~\*'\(\):@&=\+\$,]";

        //At least one valid characters followed by a slash.
        private const string _virtualPathSegmentRegex = _validVirtualPathCharactersRegex + @"+/";

        //A slash followed by one or more virtual path segments - also allows just a single slash.
        //This regex will be used to validate RootDir. The complete regex looks like this:
        //^/(?:[a-zA-Z0-9\-_\.!\~\*'\(\):@&=\+\$,]+/)*$
        private const string _exclusiveHostRelativeVirtualPathRegex = @"^/(?:" + _virtualPathSegmentRegex + @")*$";

        //A slash or tilde-slash followed by any number of virtual path segments.
        private const string _hostOrAppRelativeVirtualPathRegex = @"(?:~/|/)(?:" + _virtualPathSegmentRegex + @")*";

        //A string that just contains ONE host- or app-relative virtual path. This regex will be used to validate UploadDir.
        //The complete regex looks like this:
        //^(?:~/|/)(?:[a-zA-Z0-9\-_\.!\~\*'\(\):@&=\+\$,]+/)*$
        private const string _exclusiveHostOrAppRelativeVirtualPathRegex = @"^" + _hostOrAppRelativeVirtualPathRegex + @"$";

        //A host- or app-relative virtual path followed by a filename with any extension.
        private const string _hostOrAppRelativeVirtualFilePathRegex = _hostOrAppRelativeVirtualPathRegex + @"[\-\w]+\.[\w]+";

        //Any number of host- or app-relative file paths separated by commas, whitespaces are allowed before and after comma. The last path 
        //must not end with a comma. This regex will be used to validate EditorCSS. A string with only white space is also ok. The complete regex looks like this:
        //^[\s]*$|^(?:(?:~/|/)(?:[a-zA-Z0-9\-_\.!\~\*'\(\):@&=\+\$,]+/)*[\w]+\.[\w]+[\s]*,[\s]*)*(?:(?:~/|/)(?:[a-zA-Z0-9\-_\.!\~\*'\(\):@&=\+\$,]+/)*[\w]+\.[\w]+){1}[\s]*$
        private const string _exclusiveCommaSeparatedHostOrAppRelativeVirtualFilePathsRegex =
            @"^[\s]*$|^(?:" + _hostOrAppRelativeVirtualFilePathRegex + @"[\s]*,[\s]*)*(?:" + _hostOrAppRelativeVirtualFilePathRegex + @"){1}[\s]*$";

        //any number of pipe separate words.
        //E.g match: "kalle", "kalle|nisse"
        //none match "|", "|kalle", "kalle|"
        private const string _pipeSeparatedWords = "^([a-z]|[A-Z])+(\\|([a-z]|[A-Z])+)*$";

        #endregion

        #region Validation errors definition

        // Friendly validation errors for the regular expressions found in the "Regexp definitions"-region.
        private const string _exclusiveHostRelativeVirtualPathRegexValidationError =
            "The string must be either a single slash or a host-relative directory path, e.g. '/' or '/rootFolder/'.";

        private const string _exclusiveHostOrAppRelativeVirtualPathRegexValidationError =
            "The string must contain one application- or host-relative virtual directory path, e.g. '~/myFolder/' or '/secret/folder/'.";

        private const string _exclusiveCommaSeparatedHostOrAppRelativeVirtualFilePathsRegexValidationError =
            "The string must contain one or more comma-separated application- or host-relative virtual file paths, e.g. '~/folder/some.file, /another.file'.";

        #endregion

        #region Constructor
        /// <summary>
        /// Initializes a new instance of the <see cref="Settings"/> class.
        /// </summary>
        public Settings()
            : base("siteSettings")
        {
        }
        #endregion

        /// <summary>
        /// Gets the version of this configuration.
        /// </summary>
        public string Version
        {
            get
            {
                object[] product;
                product = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyProductAttribute), false);
                return ((AssemblyProductAttribute)product[0]).Product + " " + Assembly.GetExecutingAssembly().GetName().Version.ToString();
            }
        }

        /// <summary>
        /// Save method for the web.config file
        /// </summary>
        /// <returns></returns>
        public void Save()
        {
            EPiServerSection.CurrentConfiguration.Save(ConfigurationSaveMode.Modified);
        }

        /// <summary>
        /// Get the current configuration settings.
        /// </summary>
        public static EPiServer.Configuration.Settings Instance
        {
            get
            {
                if (HttpContext.Current == null)
                {
                    if (_instance == null)
                    {
                        throw new ApplicationException("First time you call Settings.Instance you must have a valid HttpContext.");
                    }

                    // Since we have no HttpContext, we cannot validate that we use the correct 
                    // Settings instance. It will be validated as soon as we have a HttpContext.
                    return _instance;
                }

                Settings current = MapUrlToSettings(HttpContext.Current.Request.Url);
                if (_instance == null)
                {
                    _instance = current;
                }
                else if (_instance != current)
                {
                    // We have a mismatch - the current request has a Settings mapping that is not the same as the "original"
                    // Settings for this AppDomain
                    throw new ConfigurationErrorsException(String.Format("Application is initialized with settings for siteId=\"{0}\", but current request maps to siteId=\"{1}\"", _instance.Parent.SiteId, current.Parent.SiteId));
                }
                return _instance;
            }
            set { _instance = value; }
        }

        /// <summary>
        /// Gets a <see cref="T:System.Collections.Generic.Dictionary"/> containing all Settings instances
        /// in the application's configuration file. The Dictionary uses the site-tags' applicationId attribute as keys.
        /// </summary>
        public static IDictionary<String, Settings> All
        {
            get
            {
                if (_all == null)
                {
                    InitializeAllSettings();
                }
                return _all;
            }
            protected set { _all = value; }
        }

        /// <summary>
        /// Maps a host name to a <see cref="T:EPiServer.Configuration.Settings"/> instance.
        /// </summary>
        /// <param name="hostName">The host name.</param>
        /// <param name="fallback">Specifies whether to use a fallback settings instance or not.</param>
        /// <returns>A Settings instance with configuration information to handle this request.</returns>
        /// <remarks>
        /// This is used for EPiServer Enterprise solutions where you have multiple &lt;settings&gt; sections in the
        /// same web.config file.
        /// </remarks>
        public static Settings MapHostToSettings(string hostName, bool fallback)
        {
            if (_hostToSettings == null)
            {
                InitializeAllSettings();
            }

            Settings settings;
            if (_hostToSettings.TryGetValue(hostName, out settings))
            {
                return settings;
            }
            return fallback ? _hostToSettings[_fallbackHost] : null;
        }

        /// <summary>
        /// Maps url to a <see cref="T:EPiServer.Configuration.Settings"/> instance.
        /// </summary>
        /// <param name="url">The URL.</param>
        /// <returns></returns>
        /// <remarks>
        /// This is used for EPiServer Enterprise solutions where you have multiple &lt;settings&gt; sections in the
        /// same web.config file. if the host name that is safe to use for DNS resolution does NOT exist 
        /// then it maps to fallback host which is indicates with "*"
        /// </remarks>
        /// <exception cref="System.ArgumentNullException">
        /// Thrown ArgumentNullException if the uri is null
        /// </exception>
        /// <exception cref="System.ArgumentException">
        /// Thrown ArgumentException if the uri is NOT absolute
        /// </exception>
        /// <exception cref="System.Configuration.ConfigurationErrorsException">
        /// If the uri absolute path is NOT equal with the site settings absoulte path.
        /// Hits when the uri has a path that is outside of the application root
        /// </exception>
        public static Settings MapUrlToSettings(Uri url)
        {
            if (url == null)
            {
                throw new ArgumentNullException("url", "An initialized Uri instance is required.");
            }

            if (!url.IsAbsoluteUri)
            {
                throw new ArgumentException("The Uri must be absolute to use for mapping.", "url");
            }

            Settings current;
            if (!String.IsNullOrEmpty(url.DnsSafeHost))
            {
                // Maps the host name to a  Settings
                current = MapHostToSettings(url.DnsSafeHost, true);
            }
            else
            {
                // Take the fallback Host ("*") Settings
                current = MapHostToSettings(_fallbackHost, true);
            }

            // Get the absolute path of the uri
            string incomingPath = url.AbsolutePath;

            // Get the asoulte path of site settings Url
            string settingsPath = current.SiteUrl.AbsolutePath;
            if (incomingPath.StartsWith(settingsPath, StringComparison.OrdinalIgnoreCase))
            {
                return current;
            }

            // We have one special case to consider, the incoming request might not be terminated with a slash but
            // otherwise points to the application root for the current site. I e incomingPath is "/site", but the
            // SiteUrl will always be terminated with a slash "/site/". This condition is not caught with the 
            // previous check.
            if (String.Equals(incomingPath + "/", settingsPath, StringComparison.OrdinalIgnoreCase))
            {
                return current;
            }

            throw new ConfigurationErrorsException(String.Format("The URL \"{0}\" maps to siteId=\"{1}\" but has a path that is outside the application root (application root is \"{2}\").", url.ToString(), current.Parent.SiteId, current.SiteUrl.AbsolutePath));
        }

        /// <summary>
        /// Sets up all static variables of the Settings class based on the web.config file in the applications root directory.
        /// </summary>
        /// <returns></returns>
        public static void InitializeAllSettings()
        {
            InitializeAllSettings(EPiServerSection.CurrentConfiguration);
        }

        /// <summary>
        /// Sets up all static variables of the Settings class based on System.Configuration.Configuration object passed as a parameter.
        /// </summary>
        /// <param name="config">The System.Configuration.Configuration object that contains the EPiServer settings.</param>
        /// <returns></returns>
        /// <exception cref="System.Configuration.ConfigurationErrorsException">
        /// If there is an enterprise solution and the siteHosts section is missing with the value "*" 
        /// </exception>
        public static void InitializeAllSettings(System.Configuration.Configuration config)
        {
            // Local variables used to temporarily hold the new values so that this function works as a transaction.
            Dictionary<String, Settings> all = new Dictionary<String, Settings>(StringComparer.OrdinalIgnoreCase);
            Dictionary<String, Settings> mapHost = new Dictionary<String, Settings>(StringComparer.OrdinalIgnoreCase);

            EPiServerSection section = EPiServerSection.GetAndValidateSection(config);

            //Iterate all sites element
            foreach (SiteElement element in section.Sites)
            {
                element.SiteSettings.Parent = element;
                all.Add(element.SiteId, element.SiteSettings);
                // Add the site element to mapHost collection 
                AddHostMappings(element, mapHost);
            }

            // Thrown Exception is there is NOT a fallback Host
            if (!mapHost.ContainsKey(_fallbackHost))
            {
                throw new ConfigurationErrorsException("At least one <site> section must omit the <siteHosts> section, or <add name=\"*\"> to the <siteHosts> section.");
            }

            // All values could be read without problems - transfer the local variables' values to the static variables.
            All = all;
            _hostToSettings = mapHost;
            _instance = null;   // Force re-initialization of Instance
            EPiServerSection.CurrentConfiguration = config;
        }

        /// <summary>
        /// Adds the host mappings.
        /// </summary>
        /// <param name="element">The element.</param>
        /// <param name="mapHost">The map host.</param>
        private static void AddHostMappings(SiteElement element, IDictionary<string, Settings> mapHost)
        {
            if (element.SiteHosts == null || element.SiteHosts.Count == 0)
            {
                SetFallbackSettings(element.SiteSettings, mapHost);
            }
            else
            {
                foreach (HostNameElement hostName in element.SiteHosts)
                {
                    if (mapHost.ContainsKey(hostName.Name))
                    {
                        throw new ConfigurationErrorsException("A host name can occur only once. " + hostName.Name + "in <siteHosts> has already been defined.");
                    }
                    if (hostName.Name == _fallbackHost)
                    {
                        SetFallbackSettings(element.SiteSettings, mapHost);
                    }
                    else
                    {
                        mapHost.Add(hostName.Name, element.SiteSettings);
                    }
                }
            }

            //Add SiteUrl to hostMap as well (if not already added)
            Settings mappedHost;
            if (mapHost.TryGetValue(element.SiteSettings.SiteUrl.Host, out mappedHost))
            {
                if (!String.Equals(mappedHost.SiteUrl.Host, element.SiteSettings.SiteUrl.Host))
                {
                    throw new ConfigurationErrorsException(element.SiteSettings.SiteUrl.Host + " is configured as SiteUrl for one site and in siteHosts section for another site which is not allowed.");
                }
            }
            else
            {
                mapHost.Add(element.SiteSettings.SiteUrl.Host, element.SiteSettings);
            }

        }

        /// <summary>
        /// Sets the fallback settings.
        /// </summary>
        /// <param name="value">The value.</param>
        /// <param name="mapHost">The map host.</param>
        private static void SetFallbackSettings(Settings value, IDictionary<string, Settings> mapHost)
        {
            if (mapHost.ContainsKey(_fallbackHost))
            {
                throw new ConfigurationErrorsException("Only one <site> section without a <siteHosts> element is allowed. A <siteHosts> <add name=\"*\" /> </siteHosts> is the same as not defining a siteHosts element.");
            }
            mapHost.Add(_fallbackHost, value);
        }

        /// <summary>
        /// Gets or sets the parent.
        /// </summary>
        /// <value>The parent.</value>
        public SiteElement Parent
        {
            get { return _parent; }
            private set { _parent = value; }
        }

        #region Advanced
        /// <summary>
        /// Set to true to disable EPiServer's connection with the scheduler. Default value (if the tag does not exist) is true.
        /// </summary>
        [ConfigurationProperty("enableScheduler", DefaultValue = "true", IsRequired = false)]
        [BoolValidator()]
        [ManagerTabAttribute(ManagerTab.Advanced)]
        public bool EnableScheduler
        {
            get
            {
                return (bool)this["enableScheduler"];
            }
            set
            {
                this["enableScheduler"] = value;
            }
        }

        /// <summary>
        /// Set to the number of characters when compression should be activated.
        /// </summary>
        [ConfigurationProperty("stringCompressionThreshold", DefaultValue = 0, IsRequired = false)]
        [IntegerValidator(MinValue = 0, MaxValue = Int32.MaxValue)]
        [ManagerTabAttribute(ManagerTab.Advanced)]
        public Int32 StringCompressionThreshold
        {
            get
            {
                return (Int32)this["stringCompressionThreshold"];
            }
            set
            {
                this["stringCompressionThreshold"] = value;
            }
        }

        /// <summary>
        /// The number of characters when delayed loading should be activated for large strings in properties deriving from Long String.
        /// </summary>
        [ConfigurationProperty("stringDelayedLoadThreshold", DefaultValue = 0, IsRequired = false)]
        [IntegerValidator(MinValue = 0, MaxValue = Int32.MaxValue)]
        [ManagerTabAttribute(ManagerTab.Advanced)]
        public Int32 StringDelayedLoadThreshold
        {
            get
            {
                return (Int32)this["stringDelayedLoadThreshold"];
            }
            set
            {
                this["stringDelayedLoadThreshold"] = value;
            }
        }

        /// <summary>
        /// Set the System.Threading.Thread.CurrentThread.CurrentCulture if handling pages remote
        /// </summary>
        [ConfigurationProperty("remoteWebServiceCulture", DefaultValue = 0, IsRequired = false)]
        [IntegerValidator(MinValue = 0, MaxValue = Int32.MaxValue)]
        [ManagerTabAttribute(ManagerTab.Advanced)]
        public Int32 RemoteWebServiceCulture
        {
            get
            {
                return (Int32)this["remoteWebServiceCulture"];
            }
            set
            {
                this["remoteWebServiceCulture"] = value;
            }
        }

        /// <summary>
        /// Delay time between publish and indexing
        /// </summary>
        [ConfigurationProperty("indexingDelayAfterPublish", DefaultValue = "0:0:20", IsRequired = false)]
        [TimeSpanValidator()]
        [ManagerTabAttribute(ManagerTab.Advanced)]
        public TimeSpan IndexingDelayAfterPublish
        {
            get
            {
                return (TimeSpan)this["indexingDelayAfterPublish"];
            }
            set
            {
                this["indexingDelayAfterPublish"] = value;
            }
        }

        /// <summary>
        /// If indexing of text into keywords should be enabled
        /// </summary>
        [ConfigurationProperty("indexingTextEnabled", DefaultValue = "true", IsRequired = false)]
        [BoolValidator()]
        [ManagerTabAttribute(ManagerTab.Advanced)]
        public bool IndexingTextEnabled
        {
            get
            {
                return (bool)this["indexingTextEnabled"];
            }
            set
            {
                this["indexingTextEnabled"] = value;
            }
        }

        /// <summary>
        /// The index of the EditPanel tab that is to be shown by default when clicking a page in the editmode pagetree.
        /// </summary>
        /// <remarks>
        /// The value of this property is used as an zero-based index in an array of EditPanel tabs.
        /// For example, all pages in a default installation of the example will have the following tabs:
        /// 
        /// Tab name        Index
        /// View            0
        /// Edit            1
        /// Version list    2
        /// </remarks>
        [ConfigurationProperty("uiDefaultPanelTab", DefaultValue = 0, IsRequired = false)]
        [IntegerValidator(MinValue = 0, MaxValue = Int32.MaxValue)]
        [ManagerTabAttribute(ManagerTab.Advanced)]
        public Int32 UIDefaultPanelTab
        {
            get
            {
                return (Int32)this["uiDefaultPanelTab"];
            }
            set
            {
                this["uiDefaultPanelTab"] = value;
            }
        }

        /// <summary>
        /// The regular expression to index words in pages
        /// </summary>
        [ConfigurationProperty("indexingTextRegExp", DefaultValue = @"[\p{N}\p{L}]{1}[\p{N}\p{L}-\._]*[\p{N}\p{L}]{1}", IsRequired = false)]
        [StringValidator(InvalidCharacters = "", MinLength = 0, MaxLength = 256)]
        [ManagerTabAttribute(ManagerTab.Advanced)]
        public String IndexingTextRegExp
        {
            get
            {
                return (String)this["indexingTextRegExp"];
            }
            set
            {
                this["indexingTextRegExp"] = value;
            }
        }

        /// <summary>
        /// URL to the log service
        /// </summary>
        [ConfigurationProperty("logServiceUrl", DefaultValue = "soap.tcp://localhost/TimeSpanAnalyzerView", IsRequired = false)]
        [UriValidator()]
        [ManagerTabAttribute(ManagerTab.Advanced)]
        public Uri LogServiceUrl
        {
            get
            {
                return (Uri)this["logServiceUrl"];
            }
            set
            {
                this["logServiceUrl"] = value;
            }
        }

        /// <summary>
        /// The color that should replace the transparent color in a picture compression
        /// </summary>
        [ConfigurationProperty("uiImageTransparencyReplacement", DefaultValue = "White", IsRequired = false)]
        [ColorValidator()]
        [ManagerTabAttribute(ManagerTab.Advanced)]
        public Color UIImageTransparencyReplacement
        {
            get
            {
                return (Color)this["uiImageTransparencyReplacement"];
            }
            set
            {
                this["uiImageTransparencyReplacement"] = value;
            }
        }

        /// <summary>
        /// Set whether you want to use EPiServer's error handling.
        /// </summary>
        [ConfigurationProperty("globalErrorHandling", DefaultValue = "RemoteOnly", IsRequired = false)]
        [RegexStringValidator(@"^RemoteOnly$|^On$|^Off$")]
        [ManagerTabAttribute(ManagerTab.Advanced)]
        public String GlobalErrorHandling
        {
            get
            {
                return (String)this["globalErrorHandling"];
            }
            set
            {
                this["globalErrorHandling"] = value;
            }
        }

        /// <summary>
        /// Set which tags should not be encoded
        /// </summary>
        [ConfigurationProperty("uiSafeHtmlTags", DefaultValue = "b,i,u,br", IsRequired = false)]
        [StringValidator(InvalidCharacters = "~!@#$%^&*()[]{}/;'\"|\\", MinLength = 0, MaxLength = 256)]
        [ManagerTabAttribute(ManagerTab.Advanced)]
        public string UISafeHtmlTags
        {
            get
            {
                return (string)this["uiSafeHtmlTags"];
            }
            set
            {
                this["uiSafeHtmlTags"] = value;
            }
        }

        /// <summary>
        /// Sets if page tree controls should evaluate if tree nodes have children.
        /// </summary>
        /// <remarks>
        /// Default value is <b>false</b>. If set to <b>true</b>, tree controls will not evaluate if a node has children when it becomes visible.
        /// Only nodes that have children will display an expand icon ([+]), i.e. [+]NodeName. 
        /// If set to <b>true</b>, tree controls will not evaluate if a node has children when it becomes visible. Thus all nodes will display
        /// an expand icon, regardless of if it has children or not. This behaviour will increase performace when displaying large tree structures.
        /// </remarks>
        [ConfigurationProperty("uiOptimizeTreeForSpeed", DefaultValue = "false", IsRequired = false)]
        [BoolValidator()]
        [ManagerTabAttribute(ManagerTab.Advanced)]
        public bool UIOptimizeTreeForSpeed
        {
            get
            {
                return (bool)this["uiOptimizeTreeForSpeed"];
            }
            set
            {
                this["uiOptimizeTreeForSpeed"] = value;
            }
        }

        /// <summary>
        /// Defines whether SgmlParser should decode character entitities (like "&#32;") or not.
        /// </summary>
        [ConfigurationProperty("sgmlParserDecodeCharEntities", DefaultValue = "false", IsRequired = false)]
        [BoolValidator()]
        [ManagerTabAttribute(ManagerTab.Advanced)]
        public Boolean SgmlParserDecodeCharEntities
        {
            get
            {
                return (bool)this["sgmlParserDecodeCharEntities"];
            }
            set
            {
                this["sgmlParserDecodeCharEntities"] = value;
            }
        }

        /// <summary>
        /// Defines whether xmlrpc headers should be added to page output. 
        /// </summary>
        [ConfigurationProperty("enableXmlRpcHeader", DefaultValue = "false", IsRequired = false)]
        [BoolValidator()]
        [ManagerTabAttribute(ManagerTab.Advanced)]
        public Boolean EnableXmlRpcHeader
        {
            get
            {
                return (bool)this["enableXmlRpcHeader"];
            }
            set
            {
                this["enableXmlRpcHeader"] = value;
            }
        }
        #endregion

        #region Cache

        //This property is read from an internal class since the ConfigurationProperty
        //is not capable of reading a string array. In order not to change the behaviour
        //in the core code, a wrapper class is used to get and set the value.
        [ConfigurationProperty("remoteCacheListenerShortNames", DefaultValue = "", IsRequired = false)
          ]
        [StringValidator(InvalidCharacters = "~!@#$%^&*()[]{}/;'\"|\\", MinLength = 0, MaxLength = 256)]
        private String RemoteCacheListenerShortNamesInternal
        {
            get
            {
                return (String)this["remoteCacheListenerShortNames"];
            }
            set
            {
                this["remoteCacheListenerShortNames"] = value;
            }
        }

        /// <summary>
        /// A list of remote sites that will recieve notifications when a change is made
        /// </summary>
        [ManagerTabAttribute(ManagerTab.Cache)]
        public string[] RemoteCacheListenerShortNames
        {
            get
            {
                if (!String.IsNullOrEmpty(RemoteCacheListenerShortNamesInternal))
                {
                    return RemoteCacheListenerShortNamesInternal.Split(',');
                }
                return new string[0];
            }
            set
            {
                if (value != null)
                {
                    RemoteCacheListenerShortNamesInternal = String.Join(",", value);
                }
                else
                {
                    RemoteCacheListenerShortNamesInternal = "";
                }
            }
        }

        /// <summary>
        /// Specifies a custom text string to vary cached output responses by. Passed to Response.Cache.SetVaryByCustom.
        /// </summary>
        [ConfigurationProperty("httpCacheVaryByCustom", DefaultValue = "browser", IsRequired = false)]
        [StringValidator(InvalidCharacters = "~!@#$%^&*()[]{}/;'\"|\\", MinLength = 0, MaxLength = 256)]
        [ManagerTabAttribute(ManagerTab.Cache)]
        public String HttpCacheVaryByCustom
        {
            get
            {
                return (String)this["httpCacheVaryByCustom"];
            }
            set
            {
                this["httpCacheVaryByCustom"] = value;
            }
        }

        //This property is read from an internal class since the ConfigurationProperty
        //is not capable of reading a string array. In order not to change the behaviour
        //in the core code, a wrapper class is used to get and set the value.
        [ConfigurationProperty("httpCacheVaryByParams", DefaultValue = "id", IsRequired = false)]
        [StringValidator(InvalidCharacters = "~!@#$%^&*()[]{}/;'\"|\\", MinLength = 0, MaxLength = 256)]
        private String HttpCacheVaryByParamsInternal
        {
            get
            {
                return (String)this["httpCacheVaryByParams"];
            }
            set
            {
                this["httpCacheVaryByParams"] = value;
            }
        }

        /// <summary>
        /// The parameters to the page (i.e. querystring) that the cache should vary by. Forwarded to Response.Cache.SetVaryByParams.
        /// </summary>
        [ManagerTabAttribute(ManagerTab.Cache)]
        public string[] HttpCacheVaryByParams
        {
            get
            {
                if (!String.IsNullOrEmpty(HttpCacheVaryByParamsInternal))
                {
                    return HttpCacheVaryByParamsInternal.Split(',');
                }
                return new string[0];
            }
            set
            {
                if (value != null)
                {
                    HttpCacheVaryByParamsInternal = String.Join(",", value);
                }
                else
                {
                    HttpCacheVaryByParamsInternal = "";
                }
            }
        }

        /// <summary>
        /// Value to set the number of seconds a page should be cached.
        /// </summary>
        [ConfigurationProperty("httpCacheExpiration", DefaultValue = "0:0:0", IsRequired = false)]
        [TimeSpanValidator()]
        [ManagerTabAttribute(ManagerTab.Cache)]
        public TimeSpan HttpCacheExpiration
        {
            get
            {
                return (TimeSpan)this["httpCacheExpiration"];
            }
            set
            {
                this["httpCacheExpiration"] = value;
            }
        }

        /// <summary>
        /// Value to set the HttpCacheability enumeration for the cach.
        /// </summary>
        [ConfigurationProperty("httpCacheability", DefaultValue = HttpCacheability.Server, IsRequired = false)]
        [ManagerTabAttribute(ManagerTab.Cache)]
        public HttpCacheability HttpCacheability
        {
            get
            {
                return (HttpCacheability)this["httpCacheability"];
            }
            set
            {
                this["httpCacheability"] = value;
            }
        }

        /// <summary>
        /// The page cache interval (in hours) for the local database. Set to "0" to disable.
        /// </summary>
        [ConfigurationProperty("pageCacheSlidingExpiration", DefaultValue = "12:0:0", IsRequired = false)]
        [TimeSpanValidator()]
        [ManagerTabAttribute(ManagerTab.Cache)]
        public TimeSpan PageCacheSlidingExpiration
        {
            get
            {
                return (TimeSpan)this["pageCacheSlidingExpiration"];
            }
            set
            {
                this["pageCacheSlidingExpiration"] = value;
            }
        }

        /// <summary>
        /// The page cache intervals (in hours) for remote sites. Set to "0" to disable.
        /// </summary>
        [ConfigurationProperty("remotePageCacheSlidingExpiration", DefaultValue = "2:0:0", IsRequired = false)]
        [TimeSpanValidator()]
        [ManagerTabAttribute(ManagerTab.Cache)]
        public TimeSpan RemotePageCacheSlidingExpiration
        {
            get
            {
                return (TimeSpan)this["remotePageCacheSlidingExpiration"];
            }
            set
            {
                this["remotePageCacheSlidingExpiration"] = value;
            }
        }
        #endregion

        #region Editor

        /// <summary>
        /// Defines which css file to use when rendering the editor. Reg exp pattern
        /// for validation is "^/[\w/\.-]{1,256}".
        /// </summary>
        [ConfigurationProperty("uiEditorCssPaths", DefaultValue = "", IsRequired = false)]
        [CustomRegexStringValidator(_exclusiveCommaSeparatedHostOrAppRelativeVirtualFilePathsRegex, _exclusiveCommaSeparatedHostOrAppRelativeVirtualFilePathsRegexValidationError)]
        [ManagerTabAttribute(ManagerTab.Editor)]
        public String UIEditorCssPaths
        {
            get
            {
                return (String)this["uiEditorCssPaths"];
            }
            set
            {
                this["uiEditorCssPaths"] = value;
            }
        }

        /// <summary>
        /// Defines what colors should be available for the editors
        /// </summary>
        [ConfigurationProperty("uiEditorColors", DefaultValue = "", IsRequired = false)]
        [StringValidator(InvalidCharacters = "~!@#$%^&*()[]{}/;'\"|\\", MinLength = 0, MaxLength = 256)]
        [ManagerTabAttribute(ManagerTab.Editor)]
        public String UIEditorColors
        {
            get
            {
                return (String)this["uiEditorColors"];
            }
            set
            {
                this["uiEditorColors"] = value;
            }
        }

        /// <summary>
        /// Defines the height of the editor in edit mode
        /// </summary>
        [ConfigurationProperty("uiEditorHeight", DefaultValue = 250, IsRequired = false)]
        [IntegerValidator(MinValue = 1, MaxValue = Int32.MaxValue)]
        [ManagerTabAttribute(ManagerTab.Editor)]
        public Int32 UIEditorHeight
        {
            get
            {
                return (Int32)this["uiEditorHeight"];
            }
            set
            {
                this["uiEditorHeight"] = value;
            }
        }

        /// <summary>
        /// Defines the width of the editor in edit mode
        /// </summary>
        [ConfigurationProperty("uiEditorWidth", DefaultValue = 500, IsRequired = false)]
        [IntegerValidator(MinValue = 1, MaxValue = Int32.MaxValue)]
        [ManagerTabAttribute(ManagerTab.Editor)]
        public Int32 UIEditorWidth
        {
            get
            {
                return (Int32)this["uiEditorWidth"];
            }
            set
            {
                this["uiEditorWidth"] = value;
            }
        }

        /// <summary>
        /// Setting for use of DIV tags or P tags
        /// </summary>
        [ConfigurationProperty("uiEditorValueOptions", DefaultValue = 0, IsRequired = false)]
        [IntegerValidator(MinValue = 0, MaxValue = 15)]
        [ManagerTabAttribute(ManagerTab.Editor)]
        public Int32 UIEditorValueOptions
        {
            get
            {
                return (Int32)this["uiEditorValueOptions"];
            }
            set
            {
                this["uiEditorValueOptions"] = value;
            }
        }

        /// <summary>
        /// Controls which html tags that should not be preserved in "Remove format" action in editor.
        /// </summary>
        [ConfigurationProperty("uiEditorUnformattingPersistedTags", DefaultValue = "p|div|br|ul|li|ol", IsRequired = false)]
        [CustomRegexStringValidator(_pipeSeparatedWords, "string should be a '|' separated string of html tags")]
        [ManagerTabAttribute(ManagerTab.Editor)]
        public string UIEditorUnformattingPersistedTags
        {
            get
            {
                return (string)this["uiEditorUnformattingPersistedTags"];
            }
            set
            {
                this["uiEditorUnformattingPersistedTags"] = value;
            }
        }
        #endregion

        #region FriendlyURL
        /// <summary>
        /// Defines an extension that is mapped to ASP.NET for the URL
        /// </summary>
        [ConfigurationProperty("urlRewriteExtension", DefaultValue = "", IsRequired = false)]
        [StringValidator(InvalidCharacters = "~!@#$%^&*()[]{}/;'\"|\\", MinLength = 0, MaxLength = 256)]
        [ManagerTabAttribute(ManagerTab.FriendlyUrl)]
        public String UrlRewriteExtension
        {
            get
            {
                return (String)this["urlRewriteExtension"];
            }
            set
            {
                this["urlRewriteExtension"] = value;
            }
        }

        /// <summary>
        /// Defines an extension that is mapped to ASP.NET for the URL
        /// </summary>
        [ConfigurationProperty("UrlPreventRewriteAttribute", DefaultValue = "EPiNoRewrite", IsRequired = false)]
        [ManagerTabAttribute(ManagerTab.FriendlyUrl)]
        public String UrlPreventRewriteAttrebute
        {
            get
            {
                return (String)this["UrlPreventRewriteAttribute"];
            }
            set
            {
                this["UrlPreventRewriteAttribute"] = value;
            }
        }

        /// <summary>
        /// Defines the type of rebasing to do for links when using Friendly URLs
        /// </summary>
        [ConfigurationProperty("urlRebaseKind", DefaultValue = "Default", IsRequired = false)]
        //[StringValidator(InvalidCharacters = "~!@#$%^&*()[]{}/;'\"|\\", MinLength = 0, MaxLength = 256)]
        [ManagerTabAttribute(ManagerTab.FriendlyUrl)]
        public String UrlRebaseKind
        {
            get
            {
                return (String)this["urlRebaseKind"];
            }
            set
            {
                this["urlRebaseKind"] = value;
            }
        }
        #endregion

        #region Language
        /// <summary>
        /// Determines if the browser language should define which language is used
        /// </summary>
        [ConfigurationProperty("pageUseBrowserLanguagePreferences", DefaultValue = "false", IsRequired = false)]
        [BoolValidator()]
        [ManagerTabAttribute(ManagerTab.Language)]
        public bool PageUseBrowserLanguagePreferences
        {
            get
            {
                return (bool)this["pageUseBrowserLanguagePreferences"];
            }
            set
            {
                this["pageUseBrowserLanguagePreferences"] = value;
            }
        }

        /// <summary>
        /// Defines if the globalization module should be used
        /// </summary>
        [ConfigurationProperty("uiShowGlobalizationUserInterface", DefaultValue = "false", IsRequired = false)]
        [BoolValidator()]
        [ManagerTabAttribute(ManagerTab.Language)]
        public bool UIShowGlobalizationUserInterface
        {
            get
            {
                return (bool)this["uiShowGlobalizationUserInterface"];
            }
            set
            {
                this["uiShowGlobalizationUserInterface"] = value;
            }
        }

        #endregion

        #region Mail
        /// <summary>
        /// Defines which class should handle mail
        /// </summary>
        [ConfigurationProperty("subscriptionHandler", DefaultValue = "EPiServer.Personalization.SubscriptionMail,EPiServer", IsRequired = false)]
        [StringValidator(InvalidCharacters = "~!@#$%^&*()[]{}/;'\"|\\", MinLength = 0, MaxLength = 256)]
        [ManagerTabAttribute(ManagerTab.Mail)]
        public String SubscriptionHandler
        {
            get
            {
                return (String)this["subscriptionHandler"];
            }
            set
            {
                this["subscriptionHandler"] = value;
            }
        }

        /// <summary>
        /// E-mail address that error messages should be sent to
        /// </summary>
        [ConfigurationProperty("globalErrorMail", IsRequired = false)]
        [MailAddressValidator()]
        [TypeConverter(typeof(CustomMailAddressConverter))]
        [ManagerTabAttribute(ManagerTab.Mail)]
        public MailAddress GlobalErrorMail
        {
            get
            {
                return (MailAddress)this["globalErrorMail"];
            }
            set
            {
                this["globalErrorMail"] = value;
            }
        }
        #endregion

        #region Mirroring
        /// <summary>
        /// Number of retries when a mirroring job fails
        /// </summary>
        [ConfigurationProperty("mirroringRetries", DefaultValue = 5, IsRequired = false)]
        [IntegerValidator(MinValue = 0, MaxValue = Int32.MaxValue)]
        [ManagerTabAttribute(ManagerTab.Mirroring)]
        public Int32 MirroringRetries
        {
            get
            {
                return (Int32)this["mirroringRetries"];
            }
            set
            {
                this["mirroringRetries"] = value;
            }
        }

        /// <summary>
        /// Number of milliseconds until next retry
        /// </summary>
        [ConfigurationProperty("mirroringRetryDelay", DefaultValue = "0:0:1", IsRequired = false)]
        [TimeSpanValidator()]
        [ManagerTabAttribute(ManagerTab.Mirroring)]
        public TimeSpan MirroringRetryDelay
        {
            get
            {
                return (TimeSpan)this["mirroringRetryDelay"];
            }
            set
            {
                this["mirroringRetryDelay"] = value;
            }
        }

        /// <summary>
        /// Sets which encoding should be used when mirroring to HTML
        /// </summary>
        [ConfigurationProperty("mirroringHtmlTextEncoding", DefaultValue = "", IsRequired = false)]
        [EncodingValidator()]
        [TypeConverter(typeof(CustomEncodingConverter))]
        [ManagerTabAttribute(ManagerTab.Mirroring)]
        public Encoding MirroringHtmlTextEncoding
        {
            get
            {
                return (Encoding)this["mirroringHtmlTextEncoding"];
            }
            set
            {
                this["mirroringHtmlTextEncoding"] = value;
            }
        }

        /// <summary>
        /// Gets or sets the mirroring file write retry delay.
        /// </summary>
        /// <value>The mirroring file write retry delay.</value>
        [ConfigurationProperty("mirroringFileWriteRetryDelay", DefaultValue = "0:0:5", IsRequired = false)]
        [TimeSpanValidator()]
        [ManagerTabAttribute(ManagerTab.Mirroring)]
        public TimeSpan MirroringFileWriteRetryDelay
        {
            get
            {
                return (TimeSpan)this["mirroringFileWriteRetryDelay"];
            }
            set
            {
                this["mirroringFileWriteRetryDelay"] = value;
            }
        }

        #endregion

        #region PageConfiguration
        /// <summary>
        /// Defines ID for the root Category
        /// </summary>
        [ConfigurationProperty("categoryId", DefaultValue = 1, IsRequired = true)]
        [IntegerValidator(MinValue = 1, MaxValue = Int32.MaxValue)]
        [ManagerTabAttribute(ManagerTab.PageConfiguration)]
        public Int32 CategoryId
        {
            get
            {
                return (Int32)this["categoryId"];
            }
            set
            {
                this["categoryId"] = value;
            }
        }

        /// <summary>
        /// ID of the root folder
        /// </summary>
        [ConfigurationProperty("pageRootId", DefaultValue = 1, IsRequired = true)]
        [IntegerValidator(MinValue = 1, MaxValue = Int32.MaxValue)]
        [ManagerTabAttribute(ManagerTab.PageConfiguration)]
        public Int32 PageRootId
        {
            get
            {
                return (Int32)this["pageRootId"];
            }
            set
            {
                this["pageRootId"] = value;
            }
        }

        /// <summary>
        /// ID of the Web page that serves as the start page for the site.
        /// </summary>
        [ConfigurationProperty("pageStartId", DefaultValue = 0, IsRequired = true)]
        [IntegerValidator(MinValue = 0, MaxValue = Int32.MaxValue)]
        [ManagerTabAttribute(ManagerTab.PageConfiguration)]
        public Int32 PageStartId
        {
            get
            {
                return (Int32)this["pageStartId"];
            }
            set
            {
                this["pageStartId"] = value;
            }
        }

        /// <summary>
        /// ID of the Recycle Bin.
        /// </summary>
        [ConfigurationProperty("pageWastebasketId", DefaultValue = 2, IsRequired = true)]
        [IntegerValidator(MinValue = 1, MaxValue = Int32.MaxValue)]
        [ManagerTabAttribute(ManagerTab.PageConfiguration)]
        public Int32 PageWastebasketId
        {
            get
            {
                return (Int32)this["pageWastebasketId"];
            }
            set
            {
                this["pageWastebasketId"] = value;
            }
        }

        /// <summary>
        /// Defines from where the Office plug-in should display the site tree
        /// </summary>
        [ConfigurationProperty("pageOfficeStartId", DefaultValue = 0, IsRequired = false)]
        [IntegerValidator(MinValue = 0, MaxValue = Int32.MaxValue)]
        [ManagerTabAttribute(ManagerTab.PageConfiguration)]
        public Int32 PageOfficeStartId
        {
            get
            {
                return (Int32)this["pageOfficeStartId"];
            }
            set
            {
                this["pageOfficeStartId"] = value;
            }
        }

        /// <summary>
        /// The maximum number of page versions that EPiServer will retain.
        /// </summary>
        [ConfigurationProperty("uiMaxVersions", DefaultValue = 0, IsRequired = false)]
        [IntegerValidator(MinValue = 0, MaxValue = Int32.MaxValue)]
        [ManagerTabAttribute(ManagerTab.PageConfiguration)]
        public Int32 UIMaxVersions
        {
            get
            {
                return (Int32)this["uiMaxVersions"];
            }
            set
            {
                this["uiMaxVersions"] = value;
            }
        }

        /// <summary>
        /// Gets or sets if information on a page should be merged if it has been published while being edited.
        /// </summary>
        /// <value>
        ///     <c>false</c> to disable version merging; otherwise, <c>true</c>.
        /// </value>
        [ConfigurationProperty("uiVersionMerging", DefaultValue = "true", IsRequired = false)]
        [BoolValidator()]
        [ManagerTabAttribute(ManagerTab.PageConfiguration)]
        public bool UIVersionMerging
        {
            get
            {
                return (bool)this["uiVersionMerging"];
            }
            set
            {
                this["uiVersionMerging"] = value;
            }
        }
        #endregion

        #region Security

        /// <summary>
        /// Sets if the current template has to match the page type template
        /// </summary>
        [ConfigurationProperty("pageValidateTemplate", DefaultValue = "true", IsRequired = false)]
        [BoolValidator()]
        [ManagerTabAttribute(ManagerTab.Security)]
        public bool PageValidateTemplate
        {
            get
            {
                return (bool)this["pageValidateTemplate"];
            }
            set
            {
                this["pageValidateTemplate"] = value;
            }
        }

        /// <summary>
        /// Sets if the current windows authenticated user must reauthenticate after
        /// session timeout.
        /// </summary>
        [ConfigurationProperty("uiKeepUserLoggedOn", DefaultValue = "true", IsRequired = false)]
        [BoolValidator()]
        [ManagerTabAttribute(ManagerTab.Security)]
        public bool UIKeepUserLoggedOn
        {
            get
            {
                return (bool)this["uiKeepUserLoggedOn"];
            }
            set
            {
                this["uiKeepUserLoggedOn"] = value;
            }
        }
        #endregion

        #region Site
        /// <summary>
        /// The site name that is used when communicating with other EPiServer sites.
        /// RegExp Pattern for validation: "^([a-zA-Z0-9\.-]{0,256})$".
        /// </summary>
        [ConfigurationProperty("siteShortName", IsRequired = false)]
        [CustomRegexStringValidator(@"^([a-zA-Z0-9\.-]{0,256})$", "The string must be either an empty string or any combination of " +
            "alphanumericals, dots (.) and dashes (-) up to 256 characters long, e.g. 'site.com' or 'MySite-2'.")]
        [Obsolete("Use the SiteId property on SiteElement instead, i e use setting.Parent.SiteId rather than setting.SiteShortName", false)]
        public String SiteShortName
        {
            get
            {
                string siteName = SiteShortNameInternal;
                return String.IsNullOrEmpty(siteName) ? Parent.SiteId : siteName;
            }
            set
            {
                this["siteShortName"] = value;
            }
        }

        internal string SiteShortNameInternal
        {
            get { return (string)this["siteShortName"]; }
        }

        /// <summary>
        /// Gets or sets the site URL. It must be a Web URL, and include the path to the site root. It is only to be used
        /// to generate direct references to the site in external locations. For references from a page, use root-relative
        /// URLs and ResolveUrl etc as appropriate.
        /// </summary>
        /// <value>The site URL. Guaranteed to end with a '/'.</value>
        [ConfigurationProperty("siteUrl", DefaultValue = "http://localhost/", IsRequired = true)]
        [WebUrlValidator()]
        [ManagerTabAttribute(ManagerTab.Site)]
        public Uri SiteUrl
        {
            get
            {
                if (_cachedSiteUrl == null)
                {
                    _cachedSiteUrl = (Uri)this["siteUrl"];
                }
                return _cachedSiteUrl;
            }
            set
            {
                this["siteUrl"] = value;
                _cachedSiteUrl = value;
            }
        }

        /// <summary>
        /// Gets or sets the URL to the relocateable UI folder. It must be a Web URL, and may include scheme and port.
        /// It must be a Web URL, and include the path to the site root. It is only to be used
        /// to generate direct references to the site in external locations. For references from a page, use root-relative
        /// URLs and ResolveUrl etc as appropriate.
        /// </summary>
        /// <value>The "UI" URL. Guaranteed to end with a '/'.</value>
        [ConfigurationProperty("uiUrl", DefaultValue = "~/UI/", IsRequired = true)]
        [UrlValidator()]
        [ManagerTabAttribute(ManagerTab.Site)]
        public Uri UIUrl
        {
            get
            {
                return (Uri)this["uiUrl"];
            }
            set
            {
                this["uiUrl"] = value;
            }
        }

        /// <summary>
        /// Gets or sets the URL to the relocateable Util folder. It must be a Web URL, and may include scheme and port.
        /// It must be a Web URL, and include the path to the site root. It is only to be used
        /// to generate direct references to the site in external locations. For references from a page, use root-relative
        /// URLs and ResolveUrl etc as appropriate.
        /// </summary>
        /// <value>The "Util" URL. Guaranteed to end with a '/'.</value>
        [ConfigurationProperty("utilUrl", DefaultValue = "~/Util/", IsRequired = true)]
        [UrlValidator()]
        [ManagerTabAttribute(ManagerTab.Site)]
        public Uri UtilUrl
        {
            get
            {
                return (Uri)this["utilUrl"];
            }
            set
            {
                this["utilUrl"] = value;
            }
        }

        /// <summary>
        /// The name of the site. RegExp Pattern for validation: "^([a-zA-Z0-9\.-]{0,256})$".
        /// </summary>
        /// <value>The display name of the site.</value>
        [ConfigurationProperty("siteDisplayName", DefaultValue = "EPiServer Site", IsRequired = true)]
        [CustomRegexStringValidator(@"^([\x20a-zA-Z0-9\.-]{0,256})$", "The string must be either an empty string or any combination of " +
            "alphanumericals, dots (.), dashes (-) and spaces up to 256 characters long, e.g. 'site.com' or 'My Site-2'.")]
        [ManagerTabAttribute(ManagerTab.Site)]
        public String SiteDisplayName
        {
            get
            {
                return (String)this["siteDisplayName"];
            }
            set
            {
                this["siteDisplayName"] = value;
            }
        }

        /// <summary>
        /// Gets or sets the name of the connection string.
        /// </summary>
        /// <value>The name of the connection string.</value>
        [ConfigurationProperty("connectionStringName", DefaultValue = "EPiServerDB")]
        [ManagerTabAttribute(ManagerTab.Site)]
        public String ConnectionStringName
        {
            get
            {
                return (String)this["connectionStringName"];
            }
            set
            {
                this["connectionStringName"] = value;
            }
        }

        /// <summary>
        /// Gets or sets the error mail handler.
        /// </summary>
        /// <value>The error mail handler.</value>
        [ConfigurationProperty("errorMailHandler", DefaultValue = "~/Util/SendErrorReport.aspx", IsRequired = false)]
        [CustomRegexStringValidator(@"^(?:~/|/)(?:[a-zA-Z0-9\-_\.!\~\*'\(\):@&=\+\$,]+/)*", "The value must be a relative adress" +
            ", ie it must start with a slash or tilde-slash.")]
        [ManagerTabAttribute(ManagerTab.Site)]
        public String ErrorMailHandler
        {
            get
            {
                return (String)this["errorMailHandler"];
            }
            set
            {
                this["errorMailHandler"] = value;
            }
        }

        /// <summary>
        /// Validates all settings consistency and with the runtime.
        /// </summary>
        /// <remarks>
        /// It's ok to call frequently. It will only validate when there's a valid HtppContext and a Control
        /// handling the request, and it will only validate once.
        /// </remarks>
        public void ValidateRuntimeSettings()
        {
            string applicationRoot = VirtualPathUtility.AppendTrailingSlash(System.Web.Hosting.HostingEnvironment.ApplicationVirtualPath);
            if (String.Compare(applicationRoot, SiteUrl.AbsolutePath, StringComparison.InvariantCultureIgnoreCase) != 0)
            {
                throw new Exception(string.Format("Configuration error, SiteUrl setting '{0}' differs from IIS setting '{1}'", SiteUrl.AbsolutePath, applicationRoot));
            }
            if (!ValidateUriAgainstAppRoot(UIUrl, applicationRoot))
            {
                throw new Exception(string.Format("Configuration error, uiUrl setting '{0}' is not in application path '{1}'", UIUrl.AbsolutePath, applicationRoot));
            }
            if (!ValidateUriAgainstAppRoot(UtilUrl, applicationRoot))
            {
                throw new Exception(string.Format("Configuration error, utilUrl setting '{0}' is not in application path '{1}'", UtilUrl.AbsolutePath, applicationRoot));
            }
        }

        /// <summary>
        /// Validates the URI against app root.
        /// </summary>
        /// <param name="uri">The URI.</param>
        /// <param name="appRoot">The app root.</param>
        /// <returns></returns>
        private bool ValidateUriAgainstAppRoot(Uri uri, string appRoot)
        {
            if (uri.IsAbsoluteUri)
            {
                return uri.AbsolutePath.StartsWith(appRoot, StringComparison.OrdinalIgnoreCase);
            }
            string vpath = uri.OriginalString;
            if (vpath.StartsWith("~/"))
            {
                return true;
            }
            return vpath.StartsWith(appRoot, StringComparison.OrdinalIgnoreCase);
        }

        /// <summary>
        /// Name for the VirtualPathProvider that is responsible for handling of page folders 
        /// </summary>
        [ConfigurationProperty("pageFolderVirtualPathProvider", DefaultValue = "EPiServerPageDirectory", IsRequired = false)]
        [CustomRegexStringValidator(@"^[a-zA-Z0-9]{1,255}$", "The string must be a combination of alphanumericals, dots (.) and dashes (-) " +
            "up to 256 characters long, e.g. 'site.com' or 'MySite-2'.")]
        [ManagerTabAttribute(ManagerTab.Site)]
        public String PageFolderVirtualPathProviderName
        {
            get
            {
                return (String)this["pageFolderVirtualPathProvider"];
            }
            set
            {
                this["pageFolderVirtualPathProvider"] = value;
            }
        }

        /// <summary>
        /// Setting for what graphical theme should be used.
        /// </summary>
        [ConfigurationProperty("uiTheme", DefaultValue = "", IsRequired = false)]
        [StringValidator(InvalidCharacters = "~!@#$%^&*()[]{}/;'\"|\\", MinLength = 0, MaxLength = 256)]
        [ManagerTabAttribute(ManagerTab.Site)]
        public String UITheme
        {
            get
            {
                return (String)this["uiTheme"];
            }
            set
            {
                this["uiTheme"] = value;
            }
        }

        /// <summary>
        /// Gets or sets a value indicating whether event is enabled.
        /// </summary>
        /// <value><c>true</c> if [enable events]; otherwise, <c>false</c>.</value>
        [ConfigurationProperty("enableEvents", DefaultValue = "true", IsRequired = false)]
        [BoolValidator()]
        [ManagerTabAttribute(ManagerTab.Site)]
        public bool EnableEvents
        {
            get
            {
                return (bool)this["enableEvents"];
            }
            set
            {
                this["enableEvents"] = value;
            }
        }

        /// <summary>
        /// Gets or sets a value indicating whether remote event is enabled.
        /// </summary>
        /// <value><c>true</c> if [enable remote events]; otherwise, <c>false</c>.</value>
        [ConfigurationProperty("enableRemoteEvents", DefaultValue = "false", IsRequired = false)]
        [BoolValidator()]
        [ManagerTabAttribute(ManagerTab.Site)]
        public bool EnableRemoteEvents
        {
            get
            {
                return (bool)this["enableRemoteEvents"];
            }
            set
            {
                this["enableRemoteEvents"] = value;
            }
        }

        /// <summary>
        /// Gets or sets the operation compatibility. by default the value is None. 
        /// The operationCompatibility attribute can have None, PageStoreDelete, PageStoreSave or Full  value
        /// None: There is no Compatibility at all
        /// PageStoreSave: The save operation on Data factory Component can treat as old version of Data Factory
        /// PageStoreDelete: The Delete operation on Data factory Component can treat as old version of Data Factory
        /// Full: Both Save and Delete operation on Data FActory component treat as old version
        /// </summary>
        /// <value>The operation compatibility.</value>
        [ConfigurationProperty("operationCompatibility", DefaultValue = "None", IsRequired = false)]
        [ManagerTabAttribute(ManagerTab.Site)]
        public EPiServerCompatibility OperationCompatibility
        {
            get
            {
                return (EPiServerCompatibility)this["operationCompatibility"];
            }
            set
            {
                this["operationCompatibility"] = value;
            }
        }

        [ConfigurationProperty("wcfConfigFilePath", DefaultValue = "", IsRequired = false)]
        [ManagerTabAttribute(ManagerTab.Site)]
        public string WCFConfigFilePath
        {
            get
            {
                return (string)this["wcfConfigFilePath"];
            }
            set
            {
                this["wcfConfigFilePath"] = value;
            }
        }


        #endregion

        #region Deadlock Retry

        /// <summary>
        /// Gets or sets the number of retry attempts when a database deadlock occurs.
        /// </summary>
        /// <value>The number of retries retries.</value>
        /// <remarks>
        /// Deadlocks will usually not occur, but during special circumstances you may experience deadlocks. This could for example happen if pages are
        /// created and published very frequently (>10 pages per second).
        /// </remarks>
        [IntegerValidator(MinValue = 0, MaxValue = Int32.MaxValue)]
        [ConfigurationProperty("deadlockRetries", DefaultValue = "0", IsRequired = false)]
        public int DeadlockRetries
        {
            get
            {
                return (int)this["deadlockRetries"];
            }
            set
            {
                this["deadlockRetries"] = value;
            }
        }

        /// <summary>
        /// Gets or sets the deadlock retry delay.
        /// </summary>
        /// <value>The data access retry delay.</value>
        [TimeSpanValidator()]
        [ConfigurationProperty("deadlockRetryDelay", DefaultValue = "0:0:0", IsRequired = false)]
        public TimeSpan DeadlockRetryDelay
        {
            get
            {
                return (TimeSpan)this["deadlockRetryDelay"];
            }
            set
            {
                this["deadlockRetryDelay"] = value;
            }
        }

        #endregion

        /// <summary>
        /// Gets or sets the database query timeout.
        /// </summary>
        /// <value>The timeout value.</value>
        [TimeSpanValidator()]
        [ConfigurationProperty("databaseQueryTimeout", DefaultValue = "0:0:30", IsRequired = false)]
        public TimeSpan DatabaseQueryTimeout
        {
            get
            {
                return (TimeSpan)this["databaseQueryTimeout"];
            }
            set
            {
                this["databaseQueryTimeout"] = value;
            }
        }

    }

    /// <summary>
    /// Operation Compatibility
    /// None: There is no Compatibility at all
    /// PageStoreSave: The save operation on Data factory Component can treat as old version of Data Factory
    /// PageStoreDelete: The Delete operation on Data factory Component can treat as old version of Data Factory
    /// Full: Both Save and Delete operation on Data Factory component treat as old version
    /// </summary>
    [Flags]
    public enum EPiServerCompatibility
    {
        None = 0x0,
        PageStoreDelete = 0x1,
        PageStoreSave = 0x2,
        Full = 0xffff
    }


    /// <summary>
    /// The tabs that will be displayed in the Manager
    /// </summary>
    public enum ManagerTab
    {
        Advanced = 0,
        Cache = 1,
        Editor = 2,
        FriendlyUrl = 3,
        Language = 4,
        Mail = 5,
        Mirroring = 6,
        PageConfiguration = 7,
        Security = 8,
        Site = 9,
        ConnectionStrings = 10,
    }
}

Inheritance Hierarchy

See Also