473,383 Members | 1,866 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

user configuration settings for dll's

I have application settings working for my dll however I can't seem to
get the same result with user settings? I assume I need to open 2
configuration managers as shown below. Any idea what I'm missing? If I
try and save the user settings using DllUserConfig.Save() it raises a
general configurationexception.

app.config:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="UserSettings" type="DllConfig.UserSection,
DllConfig, Culture=neutral, PublicKeyToken=null" />
<section name="MenuSettings" type="DllConfig.ApplicationSection,
DllConfig, Culture=neutral, PublicKeyToken=null" />
</configSections>
<MenuSettings menuName="Test menu name" />
<UserSettings userName="test user name" />
</configuration>

And relevant code:

public Class1()
{
this.GetConfigurationManagers();
_AppSection = _DllConfig.GetSection("MenuSettings") as
ApplicationSection ?? new ApplicationSection();
_UserSection = _DllUserConfig.GetSection("UserSettings")
as UserSection ?? new UserSection();
}

private void GetConfigurationManagers()
{
Assembly asm = Assembly.GetAssembly(this.GetType());
ExeConfigurationFileMap map = new
ExeConfigurationFileMap();
map.ExeConfigFilename = Path.GetFullPath(asm.Location) +
".config";
map.RoamingUserConfigFilename =
Path.GetFullPath(asm.Location) + ".User" + ".config";
_DllConfig =
ConfigurationManager.OpenMappedExeConfiguration(ma p,
ConfigurationUserLevel.None);
_DllUserConfig =
ConfigurationManager.OpenMappedExeConfiguration(ma p,
ConfigurationUserLevel.PerUserRoaming);
}
Cheers,

Guy
Nov 21 '07 #1
0 1358

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

Similar topics

3
by: Florida Coder | last post by:
I have the need to store some application specific configuration data to be used by a class library and or a windows service. I would like to do this in a fashion similar to the way we do with...
5
by: Tim Marsden | last post by:
Hi How do I manually read then values held in an app.config file. I have an application with an application configuration file. I can read the values in the file using...
4
by: Andy | last post by:
Is it possible to use a Settings / Configuration file in VS 2005 / .Net 2.0 in a dll? Or is this feature limited to an executable? We have some .dlls where a configuration file would be helpful...
3
by: Trapulo | last post by:
What does mean this error? The current configuration system does not support user-scoped settings. I'm accessing a my.settings data from a DAL dll referenced by an ASP.NET app. I've a...
0
by: CoderHead | last post by:
I understand what's happening, but not why. I hope somebody else can help me out. I wrote a class library - DataAccess. This library can be included in any type of application but for now is...
6
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...
6
by: Steve Kershaw | last post by:
I have a problem in which I'm trying to access a method in a .DLL from an ASP.Net web page (written in C#). I keep on getting the error "The current configuration system does not support...
0
by: SteveKershaw | last post by:
I have a problem in which I'm trying to access a method in a .DLL from an ASP.Net web page (written in C#). I keep on getting the error "The current configuration system does not support...
1
by: Wayne | last post by:
There are two projects in my solution, one is utility dll and the other is the main executable. I have user settings in the exe project. However I want to read the settings in the utility dll so...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.