How to solve error in web.config file [Resolved]

Posted by Sekar.C under C# on 5/19/2012 | Points: 10 | Views : 5885 | Status : [Member] | Replies : 6
Hi,
I got error in web.config file this my codeing line

web.config

<connectionStrings>
<add name="connect" connectionString ="Data Source=system1;Initial Catalog=Order;Integrated Security=True"/>
</connectionStrings>
<appSettings/>
<connectionStrings/>

Order.aspx.cs

string con = ConfigurationManager.ConnectionStrings["connect"].ConnectionString;

Error Message:Sections must only appear once per config file. See the help topic <location> for exceptions.

How to solve this problem please anybody help me

Regards
Sekar.c

Regards
Sekar.c



Responses

Posted by: Ksuresh on: 5/19/2012 [Member] Starter | Points: 50

Up
0
Down

Resolved
Hi Sekar

Please,Fallow below format

<?xml version="1.0" encoding="UTF-8"?>

<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
<connectionStrings>
<add name="connect" connectionString ="Data Source=system1;Initial Catalog=Order;Integrated Security=True"/>
</connectionStrings>
<appSettings>

</appSettings>
<system.web>

</system.web>
</configuration>


Thanks
Suresh

Sekar.C, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sekar.C on: 5/19/2012 [Member] Starter | Points: 25

Up
0
Down
Hi Suresh,
I got the solution thanks for your response.

Regards
Sekar.c

Sekar.C, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Ksuresh on: 5/19/2012 [Member] Starter | Points: 25

Up
0
Down
Hi Sekar,

If your problem solved then Mark as answer above my Response.

Thanks
Suresh

Sekar.C, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sekar.C on: 5/19/2012 [Member] Starter | Points: 25

Up
0
Down
Hi suresh,
i do it


Regards
Sekar.c

Sekar.C, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Ajaybabhoria on: 5/19/2012 [Member] Starter | Points: 25

Up
0
Down
connectionstrings close only one time
after than reply me

Sekar.C, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Ajay.Kalol on: 5/21/2012 [Member] Starter | Points: 25

Up
0
Down
Check your web.config if any same section is not written twise or more.

Ajay
ajaypatelfromsanthal.blogspot.in

Sekar.C, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response