By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,544 Members | 2,065 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,544 IT Pros & Developers. It's quick & easy.

Entering new entry in Web.config produces app error

P: n/a
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>
Nov 18 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
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/de...ionsschema.asp

Ken
"Razak" <ra***@mmsc.com.my> wrote in message
news:Or**************@TK2MSFTNGP12.phx.gbl...
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>
.
.
.
</system.web>
</configuration>
Why doesn't it work for me whereas the samples implement the same method
for
configuring its app db connection?

Please help. Thanks.

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


Nov 18 '05 #2

P: n/a
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.CommunitiesSec tionHandler,ASPNET.Starter
Kit.Communities" />
<section name="pagePaths"
type="ASPNET.StarterKit.Communities.CommunitiesSec tionHandler,ASPNET.Starter
Kit.Communities" />
<section name="database"
type="ASPNET.StarterKit.Communities.CommunitiesSec tionHandler,ASPNET.Starter
Kit.Communities" />
<section name="services"
type="ASPNET.StarterKit.Communities.CommunitiesSec tionHandler,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 [Microsoft MVP]" <BA************@sympatico.ca> wrote in message
news:OP**************@TK2MSFTNGP09.phx.gbl...
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/de...ionsschema.asp
Ken
"Razak" <ra***@mmsc.com.my> wrote in message
news:Or**************@TK2MSFTNGP12.phx.gbl...
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>
.
.
.
</system.web>
</configuration>
Why doesn't it work for me whereas the samples implement the same method
for
configuring its app db connection?

Please help. Thanks.

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

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

--
---------

Nov 18 '05 #3

P: n/a
Oopss... It seems like the link you gave already have the info I need...
thanks!

----------------------------------------------------------------------------
---- -----------------------------------------------------------------------
---------
"Razak" <ra***@mmsc.com.my> wrote in message
news:%2***************@TK2MSFTNGP10.phx.gbl...
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.CommunitiesSec tionHandler,ASPNET.Starter Kit.Communities" />
<section name="pagePaths"
type="ASPNET.StarterKit.Communities.CommunitiesSec tionHandler,ASPNET.Starter Kit.Communities" />
<section name="database"
type="ASPNET.StarterKit.Communities.CommunitiesSec tionHandler,ASPNET.Starter Kit.Communities" />
<section name="services"
type="ASPNET.StarterKit.Communities.CommunitiesSec tionHandler,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 [Microsoft MVP]" <BA************@sympatico.ca> wrote in message
news:OP**************@TK2MSFTNGP09.phx.gbl...
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/de...ionsschema.asp

Ken
"Razak" <ra***@mmsc.com.my> wrote in message
news:Or**************@TK2MSFTNGP12.phx.gbl...
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>
.
.
.
</system.web>
</configuration>
Why doesn't it work for me whereas the samples implement the same method for
configuring its app db connection?

Please help. Thanks.


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


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


Nov 18 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.