473,657 Members | 2,428 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

c++ and custom section

GOE
I wrote the C++ project which impersonate Duwamish sample,when I wrote some
code about custom section,it don't work and show the exception:
"System.TypeLoa dException: accemble SystemFramework , Version=1.0.187 3.4208,
Culture=neutral , PublicKeyToken= null" type
"SystemFramewor k.ApplicationCo nfiguration" method of "Create" didn't
implement.
I rewrote the code by C#,and the web.config file was the same one, it work
very well. I can't find what's the matter.Who can tell me why?
thank you.

My C++ code like this:

using namespace System;
using namespace System::Configu ration;
using namespace System::Diagnos tics;
using namespace System::Xml;
using namespace System::Collect ions;
using namespace System::Collect ions::Specializ ed;
namespace SystemFramework
{
__gc public class ApplicationConf iguration : public
IConfigurationS ectionHandler
{

public:
ApplicationConf iguration(){};

private:
static String* appRoot;

static const String* TRACING_ENABLED = "SystemFramewor k.Tracing.Enabl ed";
static const String* TRACING_TRACEFI LE =
"SystemFramewor k.Tracing.Trace File";
static const String* TRACING_TRACELE VEL =
"SystemFramewor k.Tracing.Trace Level";
static const String* TRACING_SWITCHN AME =
"SystemFramewor k.Tracing.Switc hName";
static const String* TRACING_SWITCHD ESCRIPTION =
"SystemFramewor k.Tracing.Switc hDescription";
static const String* EVENTLOG_ENABLE D = "SystemFramewor k.EventLog.Enab led";
static const String* EVENTLOG_MACHIN ENAME =
"SystemFramewor k.EventLog.Mach ine";
static const String* EVENTLOG_SOURCE NAME =
"SystemFramewor k.EventLog.Sour ceName";
static const String* EVENTLOG_TRACEL EVEL =
"SystemFramewor k.EventLog.LogL evel";

static const bool TRACING_ENABLED _DEFAULT = true;
static const String* TRACING_TRACEFI LE_DEFAULT =
"ApplicationTra ce.txt";
static const TraceLevel TRACING_TRACELE VEL_DEFAULT = TraceLevel::Ver bose;
static const String* TRACING_SWITCHN AME_DEFAULT =
"ApplicationTra ceSwitch";
static const String* TRACING_SWITCHD ESCRIPTION_DEFA ULT =
"Applicatio n error and tracing information";
static const bool EVENTLOG_ENABLE D_DEFAULT = true;
static const String* EVENTLOG_MACHIN ENAME_DEFAULT = ".";
static const String* EVENTLOG_SOURCE NAME_DEFAULT = "WebApplication ";
static const TraceLevel EVENTLOG_TRACEL EVEL_DEFAULT = TraceLevel::Err or;

public:
Object* Create(Object* parent, Object* configContext,
System::Xml::Xm lNode* section)
{

NameValueCollec tion* settings = new NameValueCollec tion();

try
{
NameValueSectio nHandler* baseHandler = new
NameValueSectio nHandler();
settings =
__try_cast<Name ValueCollection *>(baseHandler->Create(paren t, configContext,
section));
}
catch(System::E xception*)
{
settings = 0;
}

if (settings == 0)
{
tracingEnabled = TRACING_ENABLED _DEFAULT;
tracingTraceFil e =
const_cast<Stri ng*>(TRACING_TR ACEFILE_DEFAULT );
tracingTraceLev el =
static_cast<Tra ceLevel>(TRACIN G_TRACELEVEL_DE FAULT);
tracingSwitchNa me =
const_cast<Stri ng*>(TRACING_SW ITCHNAME_DEFAUL T);
tracingSwitchDe scription =
const_cast<Stri ng*>(TRACING_SW ITCHDESCRIPTION _DEFAULT);
eventLogEnabled = EVENTLOG_ENABLE D_DEFAULT;
eventLogMachine Name =
const_cast<Stri ng*>(EVENTLOG_M ACHINENAME_DEFA ULT);
eventLogSourceN ame =
const_cast<Stri ng*>(EVENTLOG_S OURCENAME_DEFAU LT);
eventLogTraceLe vel =
static_cast<Tra ceLevel>(EVENTL OG_TRACELEVEL_D EFAULT);
}
else
{
tracingEnabled = ReadSetting(set tings,
const_cast<Stri ng*>(TRACING_EN ABLED), TRACING_ENABLED _DEFAULT);
tracingTraceFil e = ReadSetting(set tings,
const_cast<Stri ng*>(TRACING_TR ACEFILE),
const_cast<Stri ng*>(TRACING_TR ACEFILE_DEFAULT ));
tracingTraceLev el = ReadSetting(set tings,
const_cast<Stri ng*>(TRACING_TR ACELEVEL),
static_cast<Tra ceLevel>(TRACIN G_TRACELEVEL_DE FAULT));
tracingSwitchNa me = ReadSetting(set tings,
const_cast<Stri ng*>(TRACING_SW ITCHNAME),
const_cast<Stri ng*>(TRACING_SW ITCHNAME_DEFAUL T));
tracingSwitchDe scription = ReadSetting(set tings,
const_cast<Stri ng*>(TRACING_SW ITCHDESCRIPTION ),
const_cast<Stri ng*>(TRACING_SW ITCHDESCRIPTION _DEFAULT));
eventLogEnabled = ReadSetting(set tings,
const_cast<Stri ng*>(EVENTLOG_E NABLED), EVENTLOG_ENABLE D_DEFAULT);
eventLogMachine Name = ReadSetting(set tings,
const_cast<Stri ng*>(EVENTLOG_M ACHINENAME),
const_cast<Stri ng*>(EVENTLOG_M ACHINENAME_DEFA ULT));
eventLogSourceN ame = ReadSetting(set tings,
const_cast<Stri ng*>(EVENTLOG_S OURCENAME),
const_cast<Stri ng*>(EVENTLOG_S OURCENAME_DEFAU LT));
eventLogTraceLe vel = ReadSetting(set tings,
const_cast<Stri ng*>(EVENTLOG_T RACELEVEL),
static_cast<Tra ceLevel>(EVENTL OG_TRACELEVEL_D EFAULT));
}

return 0;
}
........
};
}
Nov 19 '05 #1
0 1026

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

Similar topics

1
2140
by: Hazzard | last post by:
I am trying to create a custom section and section handler in my config file. The custom section should be something like; <appSecurity> <method name = "Protect the Ice Cream"> <allow group = "admin"/> <allow group = "ice cream eaters"/> <deny group= "weightwatchers"/> <deny user = "hazz"/>
3
1500
by: Mauricio | last post by:
Hí! I´m implementing a web application using the Front Controller pattern described in the Enterprice Solutions Patters using Microsoft .NET v 1.0 In order to map an absolute path to another URL, an UrlMap class is implemented. This class implements the IConfigurationSectionHandler interface.
0
1838
by: Søren Lund | last post by:
Hello, I have implemented a custom config section handler by implementing the IConfigurationSectionHandler interface. I have registered this handler in web.config and everything works fine ... for a while. At random points in time my section handler stops working and throws the exception: Configuration Error Description: An error occurred during the processing of a configuration
4
1913
by: Nick Gilbert | last post by:
Hi, I would like the ability to store the configuration settings for all versions of my site in a single web.config file by using different sections. Eg: <siteConfig> <machine name="XENON"> <site url="/blog/"> <mode value="live">
6
3795
by: Tabi | last post by:
Hi, I want to create a custom section in my web.config that can hold my custom values. I created a section in web.config as written below. <configSections> <section name="myCustomSection" type="ComIT.Applications.Common.ConfigurationSections.MyHandler" allowLocation="true" allowDefinition="Everywhere" /> </configSections>
19
4906
by: Jamey Shuemaker | last post by:
I'm in the process of expanding my knowledge and use of Class Modules. I've perused MSDN and this and other sites, and I'm pretty comfortable with my understanding of Class Modules with the exception of custom Collection Classes. Background: I'm developing an A2K .mdb to be deployed as an .mde at my current job-site. It has several custom controls which utilize custom classes to wrap built-in controls, and add additional functionality....
2
1531
by: Laurent Bugnion | last post by:
Hi, I like to develop custom controls for a number of webpages. These controls are often customizable, so that they can be reused in a number of situations. My question is: What is the best practice for configuring a custom control. As far as I can say, I have the following alternatives: - Defining properties for the control, and setting these in the ASPX
0
1245
by: mnowosad | last post by:
This problem has become a "show-stopper" for us. I have defined a custom section for my web application that contains sensitive data. Because of that, I want to have it encrypted in the same way I encrypt the "connectionStrings" section using the ASPNET_REGIIS tool. The problem is that I get an error saying that the ASPNET_REGIIS tool can't find the assembly file that contains my custom section. My custom section is coded like that:
7
10824
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...
2
5107
by: Smithers | last post by:
I have a Windows Forms application that implements a plug-in architecture whereby required assemblies are identified and loaded dynamically. Here are the relevant classes: A = application = Windows Forms class B = a singleton hosted within A. B is responsible for dynamically loading classes X, Y, and Z.
0
8420
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
8324
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
8842
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
8740
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
8516
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
6176
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
4330
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2743
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
1970
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.