+1-888-365-2779
Try Now
More in this section

Forums / Sitefinity SDK / App.Config.... Config

App.Config.... Config

4 posts, 0 answered
  1. Steve
    Steve avatar
    3037 posts
    Registered:
    03 Dec 2008
    18 Jan 2011
    Link to this post
    Is there a place in the external config files in which I can store appSettings?

    I'd like to not store them in the web.config knowing it gets wiped on every upgrade (and backed up, but that's another step a user would have to remember)
  2. Vlad
    Vlad avatar
    498 posts
    Registered:
    15 Jul 2016
    18 Jan 2011
    Link to this post
    Hi Steve,

    Alternatively, you could implement your custom configuration settings, e.g.:

    public class AppSettingsConfig : ConfigSection
    {
        [ConfigurationProperty("backendTheme", DefaultValue = "Default", IsRequired = false)]
        public string BackendTheme
        {
            get
            {
                return (string)this["backendTheme"];
            }
            set
            {
                this["backendTheme"] = value;
            }
        }
    }

    Once you register it with:
    Config.RegisterSection(typeof(AppSettingsConfig));

    You can access it in your code with:
    Config.Get<AppSettingsConfig>().BackendTheme;


    In this case you can modify the configuration through Sitefinity UI.

    Otherwise, we have plans to implement merging of the web.configs when upgrading. Hopefully, this will be addressed in the service pack.

    All the best,
    Vlad
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. Steve
    Steve avatar
    3037 posts
    Registered:
    03 Dec 2008
    18 Jan 2011
    Link to this post
    Oh neat!

    So does that generate the xml in App_Data or is it just saved to the DB?

    Can it be implemented inside a control library to create it if it doesn't exist, then query on it?...or still the user would have to register it once.
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    18 Jan 2011
    Link to this post
    Hello Steve,

    Configurations are XML data storage. There you can persist data you want. This is just another way to persist your data. You can check this article.

    You can register configuration types either in the Global.asax file in the application start event or if you are developing a module, you can register them in the Initialize method of your module class.

    Then you can access the configurations from any control you have.

    Kind regards,
    Ivan Dimitrov
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
4 posts, 0 answered