473,785 Members | 2,882 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Custom Configuration Files...

Is it possible to create a custom configuration file (other than app.config)
that can be processed by classes in the System.Configur ation namespace?

I have seen a ton of articles that talk about custom sections (inside the
app.config file) but I would like to make an entirely new config file. I
opened a custom config file with the ConfigurationMa nager class but it seemd
as if it ignored all of the content in the config file.

Is there any decent documentation that covers this topic?

Thank you,

Jason Richmeier
May 10 '06 #1
3 5623
For any app domains that you create you can use
AppDomainSetup. ConfigurationFi le but since you do not control the creation
of your default application domain you cannot change the name. A thought
might be that you could spawn off a secondary domain from the main domain
(changing the name of the config)

Another idea would be to use ConfigurationMa nager.OpenExeCo nfiguration(fil e)
http://msdn2.microsoft.com/en-us/library/ms224437.aspx which would return
you a seperate Configuration object for the file.

Cheers,

Greg Young
MVP - C#

"Jason Richmeier" <js*@noemail.no email> wrote in message
news:02******** *************** ***********@mic rosoft.com...
Is it possible to create a custom configuration file (other than
app.config)
that can be processed by classes in the System.Configur ation namespace?

I have seen a ton of articles that talk about custom sections (inside the
app.config file) but I would like to make an entirely new config file. I
opened a custom config file with the ConfigurationMa nager class but it
seemd
as if it ignored all of the content in the config file.

Is there any decent documentation that covers this topic?

Thank you,

Jason Richmeier

May 10 '06 #2
The overload of the OpenExeConfigur ation method that you mentioned is the one
that I am using.

Here is what I did yesterday evening. In order to get something to work
quickly, I downloaded the sample application from the current issue of MSDN
magazine (about configuration files). I replaced the line of code

config =
ConfigurationMa nager.OpenExeCo nfiguration(Con figurationUserL evel.None)

with

config = ConfigurationMa nager.OpenExeCo nfiguration("d: \test.config")

I have a file named test.config with the exact same contents as the
app.config in the application located a "d:\test.config ". When I run the
application, the custom sections are ignored. When I run the application
with the original line of code, the custom sections are processed.

Is there something I am doing wrong with this?

Thank you,

Jason Richmeier

"Greg Young" wrote:
For any app domains that you create you can use
AppDomainSetup. ConfigurationFi le but since you do not control the creation
of your default application domain you cannot change the name. A thought
might be that you could spawn off a secondary domain from the main domain
(changing the name of the config)

Another idea would be to use ConfigurationMa nager.OpenExeCo nfiguration(fil e)
http://msdn2.microsoft.com/en-us/library/ms224437.aspx which would return
you a seperate Configuration object for the file.

Cheers,

Greg Young
MVP - C#

"Jason Richmeier" <js*@noemail.no email> wrote in message
news:02******** *************** ***********@mic rosoft.com...
Is it possible to create a custom configuration file (other than
app.config)
that can be processed by classes in the System.Configur ation namespace?

I have seen a ton of articles that talk about custom sections (inside the
app.config file) but I would like to make an entirely new config file. I
opened a custom config file with the ConfigurationMa nager class but it
seemd
as if it ignored all of the content in the config file.

Is there any decent documentation that covers this topic?

Thank you,

Jason Richmeier


May 10 '06 #3
Can you put up a simple example?

Cheers,

Greg Young
"Jason Richmeier" <js*@noemail.no email> wrote in message
news:3D******** *************** ***********@mic rosoft.com...
The overload of the OpenExeConfigur ation method that you mentioned is the
one
that I am using.

Here is what I did yesterday evening. In order to get something to work
quickly, I downloaded the sample application from the current issue of
MSDN
magazine (about configuration files). I replaced the line of code

config =
ConfigurationMa nager.OpenExeCo nfiguration(Con figurationUserL evel.None)

with

config = ConfigurationMa nager.OpenExeCo nfiguration("d: \test.config")

I have a file named test.config with the exact same contents as the
app.config in the application located a "d:\test.config ". When I run the
application, the custom sections are ignored. When I run the application
with the original line of code, the custom sections are processed.

Is there something I am doing wrong with this?

Thank you,

Jason Richmeier

"Greg Young" wrote:
For any app domains that you create you can use
AppDomainSetup. ConfigurationFi le but since you do not control the
creation
of your default application domain you cannot change the name. A thought
might be that you could spawn off a secondary domain from the main domain
(changing the name of the config)

Another idea would be to use
ConfigurationMa nager.OpenExeCo nfiguration(fil e)
http://msdn2.microsoft.com/en-us/library/ms224437.aspx which would return
you a seperate Configuration object for the file.

Cheers,

Greg Young
MVP - C#

"Jason Richmeier" <js*@noemail.no email> wrote in message
news:02******** *************** ***********@mic rosoft.com...
> Is it possible to create a custom configuration file (other than
> app.config)
> that can be processed by classes in the System.Configur ation namespace?
>
> I have seen a ton of articles that talk about custom sections (inside
> the
> app.config file) but I would like to make an entirely new config file.
> I
> opened a custom config file with the ConfigurationMa nager class but it
> seemd
> as if it ignored all of the content in the config file.
>
> Is there any decent documentation that covers this topic?
>
> Thank you,
>
> Jason Richmeier


May 10 '06 #4

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

Similar topics

1
1627
by: Ole Hanson | last post by:
I would like to be able to generate documentation for a custom configuration file (xml) to enable future support engineers to understand applicable values to the various elements inside the configuration file. (see below for sample). Does any program exist (like NDoc) that is able to generate MSDN like documentation?
5
2279
by: rdcpro | last post by:
In reading MSDN docs on creating custom Configuration sections, I found this page: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpgenref/html/gngrfcustomelementfornamevaluesectionhandlerdictionarysectionhandler.asp At the very bottom, it says: Configuration File This element can be used in the application configuration file, machine configuration file (Machine.config), and Web.config files that are not at the
1
2098
by: UJ | last post by:
I've got two apps that need to share a configuration file. How can I do that? It seems like ConfigurationSettings has built in to it to figure out the name of the file.
3
1595
by: Laser Lu | last post by:
Hello, everybody, In order to avoid making web.config lengthy, I just moved some custom configuration settings out from web.config, and centralized them into an xml file, which names data.config. It works fine except for one thing that the custom configuration file has a poor change awareness. Custom configuration settings can not be refreshed after the data.config file was modified. I wish the custom data.config file can works like the...
6
4815
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 =...
7
10828
by: =?Utf-8?B?RG91Z2llIEJyb3du?= | last post by:
Hi I've written custom configuration section (inherits from System.Configuration.ConfigurationSection) to simplify the contents of the config file and to make life easier when accessing them in code. The configuration section is contained within the exe (it's a simple test case!) and everything works well debugging within the IDE or if the application is deployed on a drive or share that has been granted full trust. For the share the...
0
1623
by: =?Utf-8?B?UGhpbGlw?= | last post by:
I have a web.config custom configuration section using asp.net 2.0 configuration APIs. My custom configuration section inherits from System.Configuration.ConfigurationSection. I have a IIS root level web.config and an application level web.config, with the application web.config inheriting from the root level web.config. I am receiving the following message when compiling the web application... "....Section or group name...
1
1632
by: =?Utf-8?B?SmFzb24gUmljaG1laWVy?= | last post by:
This may have been addressed in another post but I was unable to find what I was looking for. I am trying to create a custom configuration section that is element-centric instead of attribute-centric (mostly out of preference). For example... <Date> <Year>2008</Year>
4
1667
by: David Williams | last post by:
I am familiar with creating custom configuration settings and accessing them. However, for a current requirement, I need to control the various settings in my custom configuration section by virtual location of the pages accessing the configuration information. The best way that I know is to do this via the use of the location tag in the web.config. However, I can not seem to get the correct instance of the configuration section in my...
0
9645
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
9480
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10092
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
7499
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
5381
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...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4053
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
3647
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2879
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.