Question

I have a timer job that needs to connect to a SQL Database.

Where would one typically store this connection string.

In normal app development, one has app.config. Clearly using app.config in this scenario is not the right place for the configuration to be stored.

Ideally I'm looking for a way the user can change the connection string.

Do I need to create a custom list, or is there a proper way to store configuration such as this connection string?

Was it helpful?

Solution

I have posted a viable option and few pointers here.

OTHER TIPS

you could use a list, or another way is to use SPWebConfigModification to store the string you need into the appsettings node of web.config on feature activation, and just use the AppSettings property bag to access it.

The benefit of SPWebConfigModifications are that the the changes are affected to multiple web-front ends if you have many, otherwise you can make a static change to the web.config directly if you're in dev, or only have one web frontend.

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top