appsettings

Weird error message when running my application

Guys I created a console application in Visual Studio 2010. It targets the .NET framework 2.0. When I run the application is Visual Studio, it works perfect. I then exited Visual Studio and copied the executable to my C:\Windows\System32 directory. When I open a command prompt window and try to execute my program, it comes up with a stan...

Is it possible?

Hi We are thinking of moving some of the 'hard coded' settings out of our windows forms application and storing them in the sql database in a table called App_Settings. The reason for this is we have values currently hard coded into appsettings and app.config which can change over time, and it is much easier and faster to update the val...

When is using the <appSettings> section preferable to a custom configuration section?

When creating my application's or library's configuration, I generally prefer using a custom configuration section over the <appSettings> section for the following reasons. Framework serialization to a user-defined configuration object; each config value has an appropriate type Configuration values may be validated against type and val...

Issue with appSettings using 2 different projects

I'll try to do my best to explain my problem. I have 2 separate projects which are part of the same application in Visual Studio. One of them is server-sided and the other is client-sided. The client sided project uses an appSettings key called XMLFileName which is used to retrieve data from an XML and populate a dataset with the retr...

Dynamically Adding Application Settings in a WPF Application

I have a WPF application that loads different client data based on a setting in a random config file on the machine. I use the client ID read from this config file to load data from a different folder within the application. The data includes a Sql compact database, Images, Videos, etc. The content in the application will change based on...

How to update appsettings from an aspx page?

I have customer specific settings in a custom.config which links back to web.config. What I want to accomplish is to load the settings from appsettings section in custom.config into setup.aspx page. The settings will be loaded into textbox, dropdown list etc. After the user makes changes then save it back to custom.config. Is this possi...

Settings variable returning a different value in VB.net!

This is a quite strange problem. I have set a setting variable in Application settings with following data: Name: county Type: integer Scope: user Value: 0 Yet when I reference it with this statement: MsgBox(My.MySettings.Default.county) It alerts 1. Despite being the first to be executed as soon as form loads. ...

Dynamically reading app.settings in asp.net

I've moved my appsettings section outside of the web.config using: <appSettings configSource="AppSettings.config"/> This allows me to change my appsettings without actually restarting IIS. I know however, that IIS monitors all configuration files constantly. How can I attach to event my-appsetting-has-changed to take some custom a...

ConfigurationSettings.AppSettings is obsolete, warning.

var values = new NameValueCollection { { "key", ConfigurationSettings.AppSettings["API-Key"].ToString() }, { "image", Convert.ToBase64String(File.ReadAllBytes(photo.ToString())) } }; What's the new way to use the app.config file? ...

Settings.Designer.cs vs Web.config

I have just joined a project that has a connection string which is defined in the Settings.Designer.cs file and also defined in the web.config file. When I need to look at a different instance of my DB I have to modify both values. I am unfamilier with why the Settings.Designer.cs file is being used. What is the value of using Setting...

How to include dynamic information in Sharepoint master page?

We are creating several (19) sites to be hosted in Sharepoint 2007 and want to use Google Analytics. The first bit was easy, simply putting the Google Analytics javascript in the Sharepoint master page and all worked as expected. However, we want each of the 19 sites to generate seperate statistics and this is done by having a different...

Reference to a non-shared member settings error

I have added a settings file to a project but whenever I reference one of the setting variables I get the following error: Error 2 Reference to a non-shared member requires an object reference. C:\Development\PhoenixApp\Process\CreditCardProcessing.vb 67 77 Process I had to manually add this in a merge conflict and the settin...

iPhone Settings.bundle - how to disable/enable a setting based on other settings?

Hard to explain, but luckily there's an example. On an iPhone, when you go to Settings > Nike + iPod, in the app's settings, when you set Nike+iPod to off, it disables the rest of the settings. How do I do that? Use one setting to disable or toggle off another setting? ...

Nesting appSettings with the file attribute

I'm trying to pull off an inheritance chain of appSetting sections (VS2010 C#) Given this, Base.config <appSettings> <add key="basekey" value="basevalue"/> </appSettings> Derived.config <appSettings file="Base.config"> <add key="derivedkey" value="derivedvalue" /> </appSettings> App.config <configuration> <appSetting...

Modify App.config permanently C#

Hi, Ok so im trying to use the appSettings element in the App.Config file to determine what kind of storage to use. Here is my app.config file: <?xml version="1.0" encoding="utf-8" ?> <configuration> <configSections> </configSections> <appSettings> <add key="storage" value="memory"/> </appSettings> </configuration> So I wa...

Reading integers from AppSettings over and over...

Some I do quite a lot of is read integers from AppSettings. What's the best way to do this? Rather than do this every time: int page_size; if (int.TryParse( ConfigurationManager.AppSettings["PAGE_SIZE"], out page_size){ } I'm thinking a method in my Helpers class like this: int GetSettingInt(string key) { int i; return int.Tr...

Referencing AppSetting in Select property of SqlDataSource control

Hello everyone. A simple problem.... Got a SqlDataSource with a select, in this select I want to insert a value from web.config just like this <asp:SqlDataSource ... SelectCommand="SELECT field FROM table"></asp:SqlDataSource> well field is a value from web.config "Field" application setting <add key="Field" value="tablename"/> I ...

appsettings node in web.config WCF file gives an error when trying to debug

i have a WCf project, when i add the following code to the configuration file (Web.config): <configuration> <appsettings> <add key="Hello" value="5"/> </appsettings>.... i get this erro whentrying to debug: "Unable to start debugging on the web server. The web server is not configured correctly. See help for common configuration erro...

AppSettings fallback/default value?

ASP.NET For each appSetting I use, I want to specify a value that will be returned if the specified key isn't found in the appSettings. I was about to create a class to manage this, but I'm thinking this functionality is probably already in the .NET Framework somewhere? Is there a NameValueCollection/Hash/etc-type class in .NET that w...

wpf - Get values from App Config file

Hi All, How to get values from App.Config. Code: <configuration> <appSettings> <add key="ShowRoomCode" value="1000"/> <add key="FolderPath" value="D:\\Images\\Book\\"/> </appSettings> </configuration> string imageFolderPath = ConfigurationManager.AppSettings["FolderPath"]; But it returns null value. Config file is in t...