473,791 Members | 3,360 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Exception in configuration section handler using a Custom ConfigurationHa ndler

Below is what i have as the custom section in the web.config file...

<?xml version="1.0" encoding="utf-8" ?>
<configuratio n>

<!-- register local configuration handlers -->
<configSections >
<sectionGroup name="cbsoffice ">
<section name="data"
type="CbsOffice .ProviderConfig urationHandler, CbsOffice"/>
</sectionGroup>
</configSections>

*************** *************** *************** **********
***Customer web.config section******** *************** **
<cbsoffice>
<data defaultProvider ="SqlDataProvid er">
<providers>
<add name = "SqlDataProvide r"
type = "CbsOffice.Data .SqlDataProvide r,
CbsOffice.SqlDa taProvider"
connectionStrin g =
"Server=(local) ;Database=CbsOf fice;uid=;pwd=; "
providerPath =
"..\Providers\D ataProviders\Sq lDataProvider\"
objectQualifier = "_"
databaseOwner = "dbo"
/>
</providers>
</data>
</cbsoffice>

The Connection handler is below...
public class ProviderConfigu rationHandler :
IConfigurationS ectionHandler
{
public object Create(object parent, object configContext, XmlNode
section)
{
ProviderConfigu ration providerConfig= new ProviderConfigu ration();
providerConfig. LoadValuesFromC onfigurationXml (section);
return providerConfig;
}
}

The above function goes through the attributes of the dataprovider
section and puts them into a hashtable..howe ver when calling the
function:
public static ProviderConfigu ration GetProviderConf iguration(strin g
providerName)
{
return (ProviderConfig uration)Configu rationSettings. GetConfig("cbso ffice/"+providerName) ;
-> equal to "cbsoffice/data"
}

It throws the Exception in configuration section, as if its not
finding the data object at all...
Nov 18 '05 #1
2 3221
Hey Murl,
I think that you need to add your custom handler to the web config. I'm
doing some testing right now and I hope to figure this out with you.

<system.web>
<httpHandlers >
<!-- Handlers-->
<add verb="*" path="pathToThe File"
type="ProjectNa me.MyHandler, ProjectName" />
</httpHandlers>
</system.web>

Late...
Paul
"murl" wrote:
Below is what i have as the custom section in the web.config file...

<?xml version="1.0" encoding="utf-8" ?>
<configuratio n>

<!-- register local configuration handlers -->
<configSections >
<sectionGroup name="cbsoffice ">
<section name="data"
type="CbsOffice .ProviderConfig urationHandler, CbsOffice"/>
</sectionGroup>
</configSections>

*************** *************** *************** **********
***Customer web.config section******** *************** **
<cbsoffice>
<data defaultProvider ="SqlDataProvid er">
<providers>
<add name = "SqlDataProvide r"
type = "CbsOffice.Data .SqlDataProvide r,
CbsOffice.SqlDa taProvider"
connectionStrin g =
"Server=(local) ;Database=CbsOf fice;uid=;pwd=; "
providerPath =
"..\Providers\D ataProviders\Sq lDataProvider\"
objectQualifier = "_"
databaseOwner = "dbo"
/>
</providers>
</data>
</cbsoffice>

The Connection handler is below...
public class ProviderConfigu rationHandler :
IConfigurationS ectionHandler
{
public object Create(object parent, object configContext, XmlNode
section)
{
ProviderConfigu ration providerConfig= new ProviderConfigu ration();
providerConfig. LoadValuesFromC onfigurationXml (section);
return providerConfig;
}
}

The above function goes through the attributes of the dataprovider
section and puts them into a hashtable..howe ver when calling the
function:
public static ProviderConfigu ration GetProviderConf iguration(strin g
providerName)
{
return (ProviderConfig uration)Configu rationSettings. GetConfig("cbso ffice/"+providerName) ;
-> equal to "cbsoffice/data"
}

It throws the Exception in configuration section, as if its not
finding the data object at all...

Nov 18 '05 #2
Scratch that last reply :). You have that code taking care of already.

Sorry.

"murl" wrote:
Below is what i have as the custom section in the web.config file...

<?xml version="1.0" encoding="utf-8" ?>
<configuratio n>

<!-- register local configuration handlers -->
<configSections >
<sectionGroup name="cbsoffice ">
<section name="data"
type="CbsOffice .ProviderConfig urationHandler, CbsOffice"/>
</sectionGroup>
</configSections>

*************** *************** *************** **********
***Customer web.config section******** *************** **
<cbsoffice>
<data defaultProvider ="SqlDataProvid er">
<providers>
<add name = "SqlDataProvide r"
type = "CbsOffice.Data .SqlDataProvide r,
CbsOffice.SqlDa taProvider"
connectionStrin g =
"Server=(local) ;Database=CbsOf fice;uid=;pwd=; "
providerPath =
"..\Providers\D ataProviders\Sq lDataProvider\"
objectQualifier = "_"
databaseOwner = "dbo"
/>
</providers>
</data>
</cbsoffice>

The Connection handler is below...
public class ProviderConfigu rationHandler :
IConfigurationS ectionHandler
{
public object Create(object parent, object configContext, XmlNode
section)
{
ProviderConfigu ration providerConfig= new ProviderConfigu ration();
providerConfig. LoadValuesFromC onfigurationXml (section);
return providerConfig;
}
}

The above function goes through the attributes of the dataprovider
section and puts them into a hashtable..howe ver when calling the
function:
public static ProviderConfigu ration GetProviderConf iguration(strin g
providerName)
{
return (ProviderConfig uration)Configu rationSettings. GetConfig("cbso ffice/"+providerName) ;
-> equal to "cbsoffice/data"
}

It throws the Exception in configuration section, as if its not
finding the data object at all...

Nov 18 '05 #3

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

Similar topics

0
1692
by: PJdotnet | last post by:
Hi, I'm trying to use out of the box "XmlSerializerSectionHandler" section handler (without doing any custom section handler devlopment) and although I've gone thruogh all the CMAB documentation and 'quick starts' it seems I can't find the XML schema which this section handler expects to see in the configuration file. Here is the CMAB section of my 'web.config' file:
0
1509
by: Jill Graham | last post by:
Hi, I need a list of all the section names within a given sectionGroup defined in the web.config file. Is there a way to get this list using vb.net code ? Example : <configSections> <sectionGroup name="emagiCdotNet">
1
3250
by: Shaun | last post by:
Hi, I created a custom Section handler using System.configuration for Web application to read from Web.Config File. If I want to use the same handler to read from app.config file: app.config is not interpreted as XML file, & the code breaks. Here is the sample of the logic. For Each node In section.ChildNodes
1
2853
by: Ramanfromoz | last post by:
Hi, Developing a new we application. Everything okay on my local WIN XP PROFESSIONAL, IIS 5.0 running locally. The website is running smoothly. Now, the same code I am copying over to a WINDOWS 2003 SERVER, I created a new website, allocated port number 6000. Created a release version on my local machine and copied the WEB project from my local to http://ACTYD003:6000
0
1132
by: thehitman | last post by:
I used an article "Creating a Flexible Configuration Section Handler "(http://www.15seconds.com/issue/040504.htm). The Console application works with app.config but with the web.config. The Namespace change and inserting into a class library are the only differences in the code. In the web config <!-- Config section Group and Sections Declaration --> <configSections> <section name="DropDownListTableSettings"
1
2499
by: =?Utf-8?B?QnJldHQgT3NzbWFu?= | last post by:
I'm trying to set up a custome e-mail publisher for a web app using the Microsoft Exception Management Application Block for .NET sample app. Our app already uses the Exception Management Block, but with the default publishing to the Event Log. We have an error handler Intranet_Exception_Processing.Vb in the app's Component folder with the ExceptionManager.Publish(ex) call. Here is the code generating the error: ExceptionManager.VB...
1
1785
by: =?Utf-8?B?RGljaw==?= | last post by:
My Windows Application stores its configuration values in app.config and these are typed and accessed via corresponding classes, something like this... <configSections> <section name="Watcher"/> </configSections> <Watcher> <ClockWatcherCollection> <add Name="Blah"/>
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
9517
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,...
0
10428
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
10207
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
10156
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,...
0
9997
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7537
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
5435
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
4110
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
3718
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.