How can I get the connection strings - Front- & Back-End Development - Front- & Back-End Development - Progress Community
 Front- & Back-End Development

How can I get the connection strings

  • How can I get the connection strings
  • How can the a list of connection strings from sitefinitys DataConfig.config?

    I cant seem to get them from this collection
    ConfigurationManager.ConnectionStrings
  • Hi Steve,

    Please try the code below

    var dataConfig = Config.Get<DataConfig>();
    var cs = dataConfig.ConnectionStrings;


    Regards,
    Ivan Dimitrov
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  • What is the required reference for DataConfig? 

    The type or namespace name 'DataConfig' could not be found (are you missing a using directive or an assembly reference?)

     

    I want to access the Sitefinity database connection string from Data.Config.

    Or otherwise, how can I query the database directly from c#?

    Thanks.