473,804 Members | 3,461 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 3222
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
1510
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
1133
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
2501
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
10830
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
9576
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
10323
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...
0
10074
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...
0
9138
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6847
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
5515
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
4291
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
3809
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2983
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.