Home All Groups Group Topic Archive Search About

Cannot read application settings

Author
10 Oct 2006 12:35 PM
vvenk
Hello:

I've defined two application settings in my web.config file. But in the
following code :

        Dim rootWebConfig1 As System.Configuration.Configuration
        rootWebConfig1 =
System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration(Nothing)
        If (rootWebConfig1.AppSettings.Settings.Count > 0) Then

            sField1 = rootWebConfig1.AppSettings.Settings("field1")
            sField2 = rootWebConfig1.AppSettings.Settings("field2")

        End If

rootWebConfig1.AppSettings.Settings.Count  always returns 0.

What am I doing wrong?

Venki

Author
10 Oct 2006 12:46 PM
Slim
Show quote Hide quote
"vvenk" <vv***@discussions.microsoft.com> wrote in message
news:5BEE13DE-9821-4AD2-9B20-7CE1A15E796C@microsoft.com...
> Hello:
>
> I've defined two application settings in my web.config file. But in the
> following code :
>
>        Dim rootWebConfig1 As System.Configuration.Configuration
>        rootWebConfig1 =
> System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration(Nothing)
>        If (rootWebConfig1.AppSettings.Settings.Count > 0) Then
>
>            sField1 = rootWebConfig1.AppSettings.Settings("field1")
>            sField2 = rootWebConfig1.AppSettings.Settings("field2")
>
>        End If
>
> rootWebConfig1.AppSettings.Settings.Count  always returns 0.
>
> What am I doing wrong?


posting to a asp group with a asp.net problem


Show quoteHide quote
>
> Venki
>
Are all your drivers up to date? click for free checkup

Author
10 Oct 2006 12:48 PM
Dave Anderson
vvenk wrote:
>
> rootWebConfig1.AppSettings.Settings.Count  always returns 0.
>
> What am I doing wrong?

For one, you are asking in a classic ASP forum. You might have better luck
in [microsoft.public.dotnet.framework.aspnet].



--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms.

Bookmark and Share