Cannot read application settings

Discussion in 'ASP General' started by vvenk, Oct 10, 2006.

  1. vvenk

    vvenk Guest

    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
    vvenk, Oct 10, 2006
    #1
    1. Advertising

  2. vvenk

    Slim Guest

    "vvenk" <> wrote in message
    news:...
    > 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


    >
    > Venki
    >
    Slim, Oct 10, 2006
    #2
    1. Advertising

  3. 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.
    Dave Anderson, Oct 10, 2006
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Damian
    Replies:
    3
    Views:
    12,484
    Jim Cheshire [MSFT]
    Dec 30, 2003
  2. Venkat Chellam
    Replies:
    0
    Views:
    319
    Venkat Chellam
    Oct 28, 2004
  3. Siegfried Heintze
    Replies:
    0
    Views:
    2,254
    Siegfried Heintze
    Oct 24, 2005
  4. leeanne
    Replies:
    0
    Views:
    1,839
    leeanne
    Sep 24, 2008
  5. donet programmer
    Replies:
    3
    Views:
    1,515
    Gregory A. Beamer
    Nov 20, 2009
Loading...

Share This Page