appsettings

Problems attempting to read web.config from a Windows application

I'm writing a WPF application to help non-XML-savvy customers set up configuration files on a web server. web.config is one of these files. I have custom sections defined, but I've commented them out until I get the basics working. In web.config, I have this: <appSettings> <add key="buffer" value="65536"/> <add key="updateI...

Can someone provide a quick App.config/Web.config tutorial?

I've used these two configuration files many times before, but I've never taken the time to fully understand how they really work. As most people do, I understand the basics in how to call WebConfigurationManager.AppSettings["key"] to get config values. Here are some questions I came up with: What happens when you reference a configu...

Reading settings from app.config or web.config in .net

I'm working on a C# class library that needs to be able to read settings the web.config or app.config file (depending on whether the DLL is referenced from an ASP.NET web application or a Windows Forms application). I've found that ConfigurationSettings.AppSettings.Get("MySetting") works, but that code has been marked as deprecated by M...

How do I share the appsettings among various AppDomains in .NET

I would like to share my AppSettings from Application.exe.config to be shared/used by the newly created AppDomains . I am creating AppDomains as shown below public static AppDomain Create(Guid sessionId) { AppDomain currentDomain = AppDomain.CurrentDomain; AppDomainSetup setup = new AppDomainSetup(); // use the ID a...

Reading dll.config (not app.config!) from a plugin module.

I am writing a C# .NET 2.0 .dll that is a plug in to a Larger application. The visual studio project for my module has a app.config file which is copied to a MyProj.dll.config along side of MyProj.dll. The plan is that MyProj.dll.config will be edited after the .dll is deployed. I am trying to read my settings from that modified loc...

Change in AppSettings needs restart my Application how can I avoid?

I'm using C# .NET 2.0 Windows Application. and I'm using app.config for my Application Settings. but change in AppSettings doesn't reflected runtime, it Needs Application to be restarted. How can I avoid it. Here is my code snippet I used to read and write the Application Settings. I'm reading the Setting like this string temp = Co...

In Shared Addin Extensibility how to get Application Configuration File?

In case of VSTO this AppDomain.CurrentDomain.SetupInformation.ConfigurationFile This Returns the Configuration file of the Executing Plugin, while shared add-in Returns False Configuration File as AppDomain returns d:\Program Files\Microsoft Office\OFFICE11\EXCEL.EXE instead of the Assembly of the Plugin. My Question is how can I get th...

ASP.NET Web.config AppSettings Performance

I have a number of appSettings in web.config that are used frequently (i.e. on each post back). Does the ConfigurationManager hold these values in process or are there any performance gains to be had by copying these values into application state on ApplicationStart() and subsequently retrieving them from there? ...

Settings.settings - How do I change from one environment to another?

I have a Web App Project (compiled DLL) along with 3 DLL projects. In my DLL projects I am using the Properties/Setting.settings to extract mutable settings from the DLL. However, when I publish from environment to the next I have not figured how to change the Settings.settings values for the new environment. It appears that the setti...

How to deploy toolbars with default locations while still using ToolStripManager?

I seem to be caught between the vs2008 settings wizard and the ToolStripManager. Here is what I want to do... During development I locate about seven toolbars each in one of three toolstrippanels in a layout that is easy for the user. Those settings are recorded in the user.config in my development folder. The ToolStripManager reads ...

Binary Serialization vs App Settings (user.config)

I am using C# (.Net 2.0) to develop windows application. I need to store nearly 50 to 60 user settings. Can anyone, please, tell which is better of the following? Binary Serialization or Application Settings (user.config) Thank you. ...

Using the database to hold application settings

I am looking at ways to make our application more extensible and easier to manipulate without having to alter the web.config (or, in our case, application.config files, which contain the appsettings node). One way I have thought about is keeping the app settings in the database table that has a sqlcachedependancy. This means that: Any...

Can i use Linq to iterate/filter my web.config AppSettings?

Hi folks, i'm trying to figure out how I can use Linq to filter out some of my appsettings from my web.config file. i'm trying to do something like the following (which has wrong syntax) :- var query = from q in System.Web.Configuration.WebConfigurationManager.AppSettings.Keys where q.StartsWith("Foo") select q...

Using configSource, and changing restartOnExternalChanges for core section

I'd like to use the configSource attribute of my web config section to define external files for various settings. Particularly, the appSettings section. This means my config file has the following entry: <appSettings configSource="My.AppSettings.config" /> However, if this file is updated, the settings are not automatically picked u...

AppSettings shourtcut question

I am trying to use the <%$ AppSettings: .. %> shortcut in an asp.net user control. I am able to use the syntax fine when binding a property to an appsetting, however I want to use an appsetting to hold a page id. for exmaple: <a href="default.aspx?page=<%$ AppSettings:TestPageID %>">Test link</a> This method does not work, so my ques...

Problems retrieving appsettings added during application start

Hi there! I appear to be having an odd issue where, in my global.asax in my Application_Start(), I have something that goes off to my database, gets all of my app settings from a name/value table, and then drops them into the application via Application.Add(name,value). I have an 'application facade' in another project which is used by...

Auto-generate an application facade from appsettings

Here's the question first: Is this possible? I'm taking my inspiration from Joe Wrobel's work (a redux of the forgotten Codeplex project). Here, you do your work on creating your profile for the provider, and it does the legwork of creating the strong typing for it, effectively creating a facade for the Profile class. And now the back ...

encapsulate AppSettings in a class?

I have code like: var mySetting = ConfigurationManager.AppSettings["mySetting"]; Is there a way to create properties that encapsulate each setting so I don't have to use string keys like "mySetting"? I know you can do that by creating a "custom configuration section", but I don't want to make another section... I want to use the exis...

How to return a verbatim string from ConfigurationManager.AppSetting["settingname"].ToString()

I am using the ConfigurationManager.AppSetting["blah"].ToString() method to get the path to the folder that contains the files I'm needing. But I'm throwing an UnsupportedFormatException on the path when it tries to use Directory.GetFiles(path). The returning value has the escape characters included and I'm not sure how to keep it from ...

ConfigurationSettings.AppSettings is empty, throws null exception

I have a class like this: public class RxNormFolderMgr { // properties public string RxNormFolder { get { return ConfigurationSettings.AppSettings["rootFolder"].ToString(); } } } When I try to use it like this: public class TestRxNormFolderManager : ColumnFixture { public string RxNormFolder() { RxNormFolderMg...