Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Umbraco version 7.1.4 / 7.1.6
Is it possible to retrieve the connection string (umbracoDbDSN) for the database from code rather than from the web.config?
I would like to do it without modifying the web.config file or hacking the core.
Hi Bo and welcome to Our.
I must say that I am not a .NET developer but working as front end developer, but I would try to help you as much as I can.
I have found these articles about how change a database connection string from code, maybe this can help you to get your wish come true to retrieve the connection string for the database from code rather than from the web.config.
Hope this can help you.
Haven't tryied it but from intellisense research in visual studio it seems that you can get the connection string with this: ApplicationContext.DatabaseContext.Database.Connection.ConnectionString.
Hope that helps!
Replying from the future as found the above isn't available in an application start-up handler.
ApplicationContext.Current.DatabaseContext.ConnectionString is though.
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted