473,396 Members | 2,030 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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

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

Nov 19 '05 #1
3 1045
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" <dr********@hotmail.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
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

Nov 19 '05 #2
It is the System.Configuration namespace.
--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net

"Andrew Fisher" <dr********@hotmail.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
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

Nov 19 '05 #3
Hi Juan and Steve,

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

Cheers
AndrewF

Nov 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: serge calderara | last post by:
Dear all, I have define a configuration file for my application with different section groups and settings belonging to each individual group like as follow : ...
6
by: Rob Mayo | last post by:
I'm developing a server control for our intranet. This control is only going to be used in two applications on the server, but they must be separate. It has been established that these 2 apps...
4
by: harvie wang | last post by:
In .Net,Through System.Configuration.ConfigurationSettings Get Application's Settings I can't find the Configuration Value from Register Where the ConfigurationSettings saved? How to Read it...
1
by: [myfirstname] | last post by:
Hello I've seen several examples around the web where people put all the values in ConfigurationSettings.AppSettings into Application State variables in global.asax, like this: foreach...
3
by: Random | last post by:
I'm writing a class library for my web app data access, but don't want to hard code the database connection string in the class. Nor do I want to pass the connection string in from the web app...
1
by: Brad Wood | last post by:
I have a 1.1 web service that creates multiple threads and makes an http call within each thread. When many threads are created, the service fails every on other call with one of these 2 errors: ...
5
by: Simon Hart | last post by:
Hi, I want to use the ConfigurationSettings.AppSettings from within a .NET class library that gets called. If using the above class, what would the name of the config file be? would this be the...
1
by: Ken | last post by:
I'm currently using 1.1. Is there any way using the value of a ConfigurationSettings.AppSettings as a key of ConfigurationSettings.AppSettings.Tosting( )]? for example in web.config <add...
2
by: mark4asp | last post by:
In trying to get the C# conversion code for Head First Design Patterns to work I came accross a number of warnings. e.g. Warning Number: 10 Description: ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.