Hello, I'm using Umbraco 4.9.1 and Umbraco 6.1.6.
Question is: how can I set umbracoDbDSN parameter programmatically in Global.asax in Application_Start method or maybe somewhere else?
But when site loads first time and umbracoDbDSN in the web.config and a connection string which is set dynamically are not the same I get exception. Because actually Umbraco uses the old connection string.
Second site loading is successful.
I don't know the answer to this but would suggest it's probably worth looking at the source code. The installer wizard must be doing this so I would expect you could see what's going on there and utilise it for your own requirements. In case you are unaware the code is available here.
Set umbracoDbDSN programmatically
Hello, I'm using Umbraco 4.9.1 and Umbraco 6.1.6. Question is: how can I set umbracoDbDSN parameter programmatically in Global.asax in Application_Start method or maybe somewhere else?
Thanks for the help.
Are you trying to set the connection string dynamically?
Yes. I'm using umbraco.GlobalSettings.DbDSN.
But when site loads first time and umbracoDbDSN in the web.config and a connection string which is set dynamically are not the same I get exception. Because actually Umbraco uses the old connection string. Second site loading is successful.
I don't know the answer to this but would suggest it's probably worth looking at the source code. The installer wizard must be doing this so I would expect you could see what's going on there and utilise it for your own requirements. In case you are unaware the code is available here.
Have a look at this Stack Overflow question. It seems to have the answer you are looking for:
is working on a reply...