More in this section

Forums / Developing with Sitefinity / How to read urlMapping value from web.config

How to read urlMapping value from web.config

2 posts, 0 answered
  1. Ivan
    Ivan avatar
    51 posts
    22 Aug 2007
    03 Dec 2009
    Link to this post

    Is it possible to programmatically read the urlMappings value from the web.config?  Is there a custom ConfigurationSection class that is available to developers? I assume that is how sitefinity reads these values internally.

  2. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    01 Feb 2016
    04 Dec 2009
    Link to this post
    Hello Ivan,

    Thank you for using our services.

    You are on the right path. Sitefinity does have configuration section handlers. In fact if you take a look at the declaration of all configuration sections in the web.config file you will see which sectiion handler is responsible for which section. However for generic content modules for example it is easier to read the default settings from an instance of the content provider. For example News content provider. Here is how to get the default URLrewrite format:
    //instantiate a content manager with the NewsProvider
    Telerik.Cms.Engine.ContentManager cntManager = new Telerik.Cms.Engine.ContentManager("News");
    //get the default url rewrite format for the news provider
    string UrlRewriteFormat = cntManager.Provider.UrlRewriteFormat;

    Kind regards,
    Radoslav Georgiev
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
2 posts, 0 answered