473,770 Members | 4,419 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Configuration.S ave() does not work?

Hello All: I have implemented a custom configuration section in my
app.config file as follows:

<configSections >
<section name="AdminUICo nfig"
type="TestMgr.U IConfigSection, TestMgr"/>
</configSections>

<AdminUIConfi g name="Admin" caption="Admini strator"
captionLC="admi nistrator">
<lookupLayout s>
<lookupLayout name="c1" caption="Admini strator" imageIndex="0"
property="FullN ame" />
<lookupLayout name="c2" caption="Email Address"
property="Email Address" />
<lookupLayout name="c3" caption="Insert By" property="Inser tBy" />
<lookupLayout name="c4" caption="Insert Date" property="Inser tDate"
/>
<lookupLayout name="c5" caption="Update By" property="Updat eBy" />
<lookupLayout name="c6" caption="Update Date" property="Updat eDate"
/>
</lookupLayouts>
</AdminUIConfig>

I can read the configuration properties from my custom section without
issue. When I modify one of the properties in this section programmaticall y
and save the configuration file nothing seems to happen? The configuration
remains changed while the application is open but when the application
restarts the changes I saved are not available?

I modify and save a property for my custom section as follows:

Dim c As Configuration
Dim s As UIConfigSection
c =
ConfigurationMa nager.OpenExeCo nfiguration(Con figurationUserL evel.None)
s = c.GetSection("A dminUIConfig")
s.captionLC = "MODIFIED!"
s.SectionInform ation.ForceSave = True
c.Save(Configur ationSaveMode.M odified)

AM I MISSING SOMETHING?

Thank you,
Shannon Richards
BBA, AIT, MCP

Mar 31 '07 #1
1 15521
All: As it turns out, the issue is not with the code as outlined below...It
is an issue as a result of running the application in the Visual Studio IDE
at design time!

http://msdn2.microsoft.com/en-us/lib...31(VS.80).aspx

Basically Visual Studio virtually hosts the application and as a result
utilizes some temporary host files. If you look in the bin directory you'll
notice a myApp.vshost.ex e.Config file. When saving configuration changes it
is actually this vshost file that is being updated not the myApp.exe.Confi g
file. If you open the myApp.vshost.ex e.Config while running your project in
the IDE you'll see your configuration changes taking effect.

Running the application as a compiled executable outside the IDE you will
notice it is indeed the myApp.exe.Confi g that is getting updated.

Shannon Richards
BBA, AIT, MCP

"Shannon Richards" <sr**********@h otmail.comwrote in message
news:91******** *************** ***********@mic rosoft.com...
Hello All: I have implemented a custom configuration section in my
app.config file as follows:

<configSections >
<section name="AdminUICo nfig"
type="TestMgr.U IConfigSection, TestMgr"/>
</configSections>

<AdminUIConfi g name="Admin" caption="Admini strator"
captionLC="admi nistrator">
<lookupLayout s>
<lookupLayout name="c1" caption="Admini strator" imageIndex="0"
property="FullN ame" />
<lookupLayout name="c2" caption="Email Address"
property="Email Address" />
<lookupLayout name="c3" caption="Insert By" property="Inser tBy" />
<lookupLayout name="c4" caption="Insert Date" property="Inser tDate"
/>
<lookupLayout name="c5" caption="Update By" property="Updat eBy" />
<lookupLayout name="c6" caption="Update Date" property="Updat eDate"
/>
</lookupLayouts>
</AdminUIConfig>

I can read the configuration properties from my custom section without
issue. When I modify one of the properties in this section
programmaticall y and save the configuration file nothing seems to happen?
The configuration remains changed while the application is open but when
the application restarts the changes I saved are not available?

I modify and save a property for my custom section as follows:

Dim c As Configuration
Dim s As UIConfigSection
c =
ConfigurationMa nager.OpenExeCo nfiguration(Con figurationUserL evel.None)
s = c.GetSection("A dminUIConfig")
s.captionLC = "MODIFIED!"
s.SectionInform ation.ForceSave = True
c.Save(Configur ationSaveMode.M odified)

AM I MISSING SOMETHING?

Thank you,
Shannon Richards
BBA, AIT, MCP
Mar 31 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
1741
by: sebsauvage | last post by:
Hello. In one of my programs ( http://sebsauvage.net/python/webgobbler/ ), I have a global dictionnary containing the whole program configuration. Sample follows: CONFIG = { "network.http.useproxy" : True, "network.http.proxy.address": "proxy.free.fr", "network.http.proxy.port" : 3128 }
2
2020
by: Al Repasky | last post by:
The program I have written with VB/NET 2003 has a Myapp.exe.config file that I did not know I would be creating. My program using an Access db and can not find the DB file after building the executable. When this config file is there it runs ok and when it is not there it can not find the DB file. When I put the program on another computer it can not find the DB file either way. Does anyone have an idea what is happening? Thanks, Al
7
5987
by: MrNobody | last post by:
I was a Java developer so I'm used to using property files as a means to keep configuration settings for my apps. I'm wondering what options are there with ..NET? Some settings I want to include are like a root directory for a target program on the user's machine my app uses, which they would be prompted to supply at startup. Normally the registry is used for this but I'd rather not use the registry if possible. Isn't there some kind of...
0
1652
by: SR | last post by:
I am trying to use the Configuration object provided with the .NET 2.0 framework. I see that when I call the Save function it does update the <application>.exe.config file. However, when I close the application and check the <application>.exe.config file again, it has reverted back to how it was when the application was started. Is there something I am doing or not doing? Here is part of my code: (And before anyone writes it, I know I...
7
6148
by: Steven Cliff | last post by:
I have started to use the new Enterprise Library (Jan 06) and have set up a skeleton project using the DAAB. This all seems to work fine apart from when I come to secure the app.config file via encryption. I have encrypted the connectionsettings block in the config file but obviously when I come to deploy the solution to other PC's, it cannot read the block as it doesn't have the keys to decrypt. I understand that as far as ASP.NET...
6
4812
by: Jeff Hegedus | last post by:
I have a dll that requires some configuration data. I put the configuration data in a custom configuration section in a config file that is loaded in the installation folder of the dll. If I install the dll to the same directory as the exe which uses it, everything works as expected but if I load the dll in any other directory, I get the following error... 2007-02-04 16:36:51,171 DEBUG CentrifugeBHO.CentrifugeBHO - dllPath =...
0
1126
by: michael1778 | last post by:
I have having trouble to get the following code (related to custom configuration .net 2.0) to work. Can anyone please help? Custom config file: <?xml version="1.0" encoding="utf-8"?> <configuration> <configSections> <section name="Config" type="LibRefresh.Config, LibRefresh" /> <section name="WebApplicationLists" type="LibRefresh.CustomConfigSection, LibRefresh" /> </configSections>
0
2623
by: =?Utf-8?B?QWxoYW1icmEgRWlkb3MgRGVzYXJyb2xsbw==?= | last post by:
Hi, thanks, mister The code string rutaConfig = tbRutaConfigServicioBase.Text; '// Map to the application configuration file. ExeConfigurationFileMap configFile = New ExeConfigurationFileMap();
0
1645
by: =?Utf-8?B?QWxoYW1icmEgRWlkb3MgRGVzYXJyb2xsbw==?= | last post by:
Hi misters, I have an app.config (UTF-8 format file). I create an application winforms for changes and save configuration programatically. When I save changes the format file changes to ANSI :( but I need format file UTF-8, and too when I open app.config and changed it, Visual Studio save it like UTF-8. Any suggestions or comments, please ? I need help about it
0
9602
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10237
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10071
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10017
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7431
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6690
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5326
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3987
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3589
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.