[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Compiler and Web.config seems confused by the <appSettings/> attribute

Posted on 2009-04-23
3
Medium Priority
?
418 Views
Last Modified: 2012-05-06
I am using visual studio 2008 with .net 3.5. I but some configuration information into strings in my web.config file.  Example: these three keys:
   <add key="ReportUser" value="ASX_SX_SQL"/>
   <add key="ReportPswd" value="deb@Colat"/>
   <add key="Domain" value="COB-US-UP"/>

I am suppose to place the information between the  <appSettings><appSettings/>  tags. I looked in my default web.config file and I only see the end tag  "<appSettings/>" but not the beginning tag that goes with it? So I added a beginning tab and the compiler throws an error message. See code snippet below. So I just removed the beginning tag and placed the code right before my closing tag. Still I am getting a compiler error. Please see the code below. What is going on? why am I getting this error
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: Unrecognized configuration section add.
 
Source Error: 
 
 
Line 9:  -->
Line 10: <configuration>
Line 11:   <add key="ReportUser" value="ASX_SX_SQL"/>
Line 12:   <add key="ReportPswd" value="deb@Colat"/>
Line 13:   <add key="Domain" value="COB-US-UP"/>
 
<configuration>
	<configSections>
		<sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
			<sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
				<section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
			</sectionGroup>
		</sectionGroup>
	</configSections>
   <add key="ReportUser" value="ASX_SX_SQL"/>
   <add key="ReportPswd" value="deb@Colat"/>
   <add key="Domain" value="COB-US-UP"/>
	<appSettings/> <!-- This is the ending "appSettings" tag, but the beginning one is nowhere to be found????
	<connectionStrings/>
	<system.web>

Open in new window

0
Comment
Question by:brgdotnet
3 Comments
 
LVL 14

Accepted Solution

by:
GiftsonDJohn earned 1120 total points
ID: 24216348
Your configuration file is wrong. it should be
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: Unrecognized configuration section add.
 
Source Error: 
 
 
Line 9:  -->
Line 10: <configuration>
Line 11:   <add key="ReportUser" value="ASX_SX_SQL"/>
Line 12:   <add key="ReportPswd" value="deb@Colat"/>
Line 13:   <add key="Domain" value="COB-US-UP"/>
 
<configuration>
        <configSections>
                <sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
                        <sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
                                <section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
                        </sectionGroup>
                </sectionGroup>
        </configSections>
   <appSettings>
   <add key="ReportUser" value="ASX_SX_SQL"/>
   <add key="ReportPswd" value="deb@Colat"/>
   <add key="Domain" value="COB-US-UP"/>
    </appSettings> <!-- This is the ending "appSettings" tag, but the beginning one is nowhere to be found????
        <connectionStrings/>
        <system.web>

Open in new window

0
 
LVL 12

Assisted Solution

by:funwithdotnet
funwithdotnet earned 80 total points
ID: 24216505
"<appSettings/>"  represents both the open & close tag.
"</appSettings>" represents only the closing tag.

GiftsonDJohn's example add the opening tag where it belongs and corrects the closing tag.
0
 
LVL 2

Author Closing Comment

by:brgdotnet
ID: 31573822
Thank you. You are correct.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses
Course of the Month19 days, 9 hours left to enroll

873 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question