ConfigurationSettings can't be seen from a code behind class?

Discussion in 'ASP .Net' started by Andrew Fisher, Jan 27, 2005.

  1. Hi all,

    I have set up some config options in the web.config file and have
    successfully used them in my test pages. When I came to abstract my
    code from the design - by using code behind files, all of a sudden I am
    told I can't use the ConfigurationSettings object because it isn't
    referenced as a namespace.

    I understand what the compiler is telling me is the problem but I'm not
    sure what namespaces I need to include to make this work?
    Any help or suggestions would be greatly appreciated.

    Cheers
    AndrewF
    Andrew Fisher, Jan 27, 2005
    #1
    1. Advertising

  2. Yoiu need to import the
    System.Configuration.ConfigurationSettings class.

    Add

    Imports System.Configuration.ConfigurationSettings

    at the top of your codebehind file.



    Juan T. Llibre
    ASP.NET MVP
    ===========
    "Andrew Fisher" <> wrote in message
    news:...
    > Hi all,
    >
    > I have set up some config options in the web.config file and have
    > successfully used them in my test pages. When I came to abstract my
    > code from the design - by using code behind files, all of a sudden I am
    > told I can't use the ConfigurationSettings object because it isn't
    > referenced as a namespace.
    >
    > I understand what the compiler is telling me is the problem but I'm not
    > sure what namespaces I need to include to make this work?
    > Any help or suggestions would be greatly appreciated.
    >
    > Cheers
    > AndrewF
    >
    Juan T. Llibre, Jan 27, 2005
    #2
    1. Advertising

  3. It is the System.Configuration namespace.


    --
    I hope this helps,
    Steve C. Orr, MCSD, MVP
    http://SteveOrr.net



    "Andrew Fisher" <> wrote in message
    news:...
    > Hi all,
    >
    > I have set up some config options in the web.config file and have
    > successfully used them in my test pages. When I came to abstract my
    > code from the design - by using code behind files, all of a sudden I am
    > told I can't use the ConfigurationSettings object because it isn't
    > referenced as a namespace.
    >
    > I understand what the compiler is telling me is the problem but I'm not
    > sure what namespaces I need to include to make this work?
    > Any help or suggestions would be greatly appreciated.
    >
    > Cheers
    > AndrewF
    >
    Steve C. Orr [MVP, MCSD], Jan 27, 2005
    #3
  4. Hi Juan and Steve,

    Works perfectly - thanks loads for that. I hoped it would be something
    simple like that

    Cheers
    AndrewF
    Andrew Fisher, Jan 28, 2005
    #4
    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. Ben Miller [msft]

    Re: Code Behind vs. no code behind: error

    Ben Miller [msft], Jun 27, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    565
    Alphonse Giambrone
    Jun 28, 2003
  2. Random
    Replies:
    3
    Views:
    4,522
    Matt Berther
    Dec 31, 2004
  3. John

    Non-code behind to code behind

    John, Feb 19, 2007, in forum: ASP .Net
    Replies:
    2
    Views:
    463
    =?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=
    Feb 19, 2007
  4. petro

    User control not seen on code beside (behind) page

    petro, Sep 22, 2006, in forum: ASP .Net Building Controls
    Replies:
    1
    Views:
    124
    petro
    Sep 25, 2006
  5. Brad Wood
    Replies:
    1
    Views:
    119
Loading...

Share This Page