Storing Setting files so they can be edited during runtime.
-
I have a web app that has a number of class library projects (which have the business logic). Currently, these class libraries each have a Settings.settings file to contain application settings (like feedback messages and format strings). During runtime i want to be able to go onto the server and change the value of one of the settings. Essentially I want what is currently available for the web project - it has a Web.config file which has all the application settings. I am able to change these settings during runtime.
-
I have a web app that has a number of class library projects (which have the business logic). Currently, these class libraries each have a Settings.settings file to contain application settings (like feedback messages and format strings). During runtime i want to be able to go onto the server and change the value of one of the settings. Essentially I want what is currently available for the web project - it has a Web.config file which has all the application settings. I am able to change these settings during runtime.
Use the app settings in your web config instead, and use HttpContext.Current ( from memory ) to read those values. Nope, completely wrong. WebConfigurationManager.AppSettings("ConnectionString") for example reads <appSettings> <add key="connectionString" value="Data Source=xxx;User ID=sa;Password=yyyyy;Initial Catalog=zzzz"/> </appSettings> from a dll in my project.
Christian Graus No longer a Microsoft MVP, but still happy to answer your questions.
-
Use the app settings in your web config instead, and use HttpContext.Current ( from memory ) to read those values. Nope, completely wrong. WebConfigurationManager.AppSettings("ConnectionString") for example reads <appSettings> <add key="connectionString" value="Data Source=xxx;User ID=sa;Password=yyyyy;Initial Catalog=zzzz"/> </appSettings> from a dll in my project.
Christian Graus No longer a Microsoft MVP, but still happy to answer your questions.
Hi, Thanks for your reply. Do you mean the Web.config file in the website? That is what i will resort to if I can't get my way, but I was hoping to still be able to use Settings.settings or something similar in the Class Library (not something in the website).