Entering new entry in Web.config produces app error

R

Razak

Hello, I'm new with ASP.NET.

I've seen samples which has custom 'entry' in Web.Config which works well.
But when I enter my 'entry', it produces app error:

The entry is like below:-

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<myAspApp>
<database>
<add key="connectionString" value="Server=sqlserver; uid=sa;
pwd=1234; database=testDB" />
</database>
</myAspApp>

<system.web>
 
R

Razak

yes.. I just found out that's one way of doing it... but I checked on a
sample project by ASP.NET Community Stater kit and they config their
application like this..

<configuration>
<configSections>
<sectionGroup name="communityStarterKit">
<section name="Isp"
type="ASPNET.StarterKit.Communities.CommunitiesSectionHandler,ASPNET.Starter
Kit.Communities" />
<section name="pagePaths"
type="ASPNET.StarterKit.Communities.CommunitiesSectionHandler,ASPNET.Starter
Kit.Communities" />
<section name="database"
type="ASPNET.StarterKit.Communities.CommunitiesSectionHandler,ASPNET.Starter
Kit.Communities" />
<section name="services"
type="ASPNET.StarterKit.Communities.CommunitiesSectionHandler,ASPNET.Starter
Kit.Communities" />
</sectionGroup>
</configSections>

<communityStarterKit>
<Isp>
<add key="IspUsername" value="admin" />
<add key="IspPassword" value="a1854928" />
</Isp>

<pagePaths>
<add key="basePage" value="/communityDefault.aspx" />
<add key="baseService" value="/communityService.asmx" />
</pagePaths>

<database>
<add key="connectionString"
value="server=localhost;uid=sa;pwd=secret;database=communityStarterKitNEW"
/>
</database>

<services>
<add key="enableServiceTimer" value="true" />
</services>
</communityStarterKit>


<system.web>
<compilation debug="false" />
......

I wonder how they come up with that. And notice that they have
<configSections> section above at the start of it. I can't find any info
about that anywhere.

Thanks.
 
R

Razak

Oopss... It seems like the link you gave already have the info I need...
thanks!

----------------------------------------------------------------------------
---- -----------------------------------------------------------------------
---------
Razak said:
yes.. I just found out that's one way of doing it... but I checked on a
sample project by ASP.NET Community Stater kit and they config their
application like this..

<configuration>
<configSections>
<sectionGroup name="communityStarterKit">
<section name="Isp"
type="ASPNET.StarterKit.Communities.CommunitiesSectionHandler,ASPNET.Starter
Kit.Communities" />
<section name="pagePaths"
type="ASPNET.StarterKit.Communities.CommunitiesSectionHandler,ASPNET.Starter
Kit.Communities" />
<section name="database"
type="ASPNET.StarterKit.Communities.CommunitiesSectionHandler,ASPNET.Starter
Kit.Communities" />
<section name="services"
type="ASPNET.StarterKit.Communities.CommunitiesSectionHandler,ASPNET.Starter
Kit.Communities" />
</sectionGroup>
</configSections>

<communityStarterKit>
<Isp>
<add key="IspUsername" value="admin" />
<add key="IspPassword" value="a1854928" />
</Isp>

<pagePaths>
<add key="basePage" value="/communityDefault.aspx" />
<add key="baseService" value="/communityService.asmx" />
</pagePaths>

<database>
<add key="connectionString"
value="server=localhost;uid=sa;pwd=secret;database=communityStarterKitNEW"
/>
</database>

<services>
<add key="enableServiceTimer" value="true" />
</services>
</communityStarterKit>


<system.web>
<compilation debug="false" />
.....

I wonder how they come up with that. And notice that they have
<configSections> section above at the start of it. I can't find any info
about that anywhere.

Thanks.

-------------------------------------------------------------------------- --
---- --------------------------------------------------------------------- --
---------
Ken Cox said:
You've got to use the correct keywords and syntax. You can't make up your
own hierarchy like that. You'll want something like this:

<appSettings>
<add key="Application1" value="MyApplication1" />
<add key="Setting1" value="MySetting" />
</appSettings>

See the hierarchy here:
http://msdn.microsoft.com/library/d...ref/html/gngrfconfigurationsectionsschema.asp

---- ---------------------------------------------------------------------
--
 

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

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,045
Latest member
DRCM

Latest Threads

Top