Problem with Web.config

D

Dave

Hello I hves some problem in my Web.conficg file.
The problem is following:

I have created some custom settings in this way:
==============================================
<!-- Define handlers of the custom settings for MailManager system -->
<configSections>
<section name="mySqlSettings"
type="System.Configuration.SingleTagSectionHandler" />
</configSections>

<!-- Define sections of the custom settings for MailManager system -->
<mySqlSettings ConnectionString="My; Connection; String" />
==============================================

Then I'm trying to read this setting from my application at runtime:
==============================================
IDictionary sampleTable = (IDictionary)
ConfigurationSettings.GetConfig("mySqlSettings");
someLabel.Text=(string)sampleTable["ConnectionString"];
==============================================

But when I do it I have the error:
==============================================
Server Error in '/WebApplication1' Application.

Configuration Error
Description: An error occurred during the processing of a configuration file
required to service this request. Please review the specific error details
below and modify your configuration file appropriately.

Parser Error Message: Exception creating section handler.

Source Error:
Line 7: <configSections>
Line 8: <section name="mySqlSettings"
Line 9: type="System.Configuration.SingleTagSectionHandler"
Line 10: />
Line 11: </configSections>

Source File: c:\inetpub\wwwroot\WebApplication1\web.config Line: 9

Version Information: Microsoft .NET Framework Version:1.1.4322.573; ASP.NET
Version:1.1.4322.573
==============================================

Can anybody tell me what I'm doing wrong and how can I fix this problem?
 
L

Lasse Edsvik

Dave,

try (with mysql-connstr ofcourse),

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="ConnectionString"
value="server=localhost;uid=sa;pwd=;database=northwind" />
</appSettings>
<system.web></system.web>
</configuration>


ConfigurationSettings.AppSettings["ConnectionString"]



hope it helps
/Lasse
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,062
Latest member
OrderKetozenseACV

Latest Threads

Top