473,625 Members | 2,662 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ConfigurationSe ttings problem?

I started a new web app.. In my Page_Load method I do this:

string strConnTxt = ConfigurationSe ttings.AppSetti ngs["ConnectStr ing"];

and the compiler gives this error:

The type or namespace name 'ConfigurationS ettings' could not be found
(are you missing a using directive or an assembly reference?)

This is a very basic thing but I can't figure out why it is happening.
Does anyone know?

Thanks for your help.
Nov 19 '05 #1
2 1103
add using System.Configur ation atop your file

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/
"Bruce W.1" <so***@noDirect Email.com> wrote in message
news:Ox******** ******@TK2MSFTN GP10.phx.gbl...
I started a new web app.. In my Page_Load method I do this:

string strConnTxt = ConfigurationSe ttings.AppSetti ngs["ConnectStr ing"];

and the compiler gives this error:

The type or namespace name 'ConfigurationS ettings' could not be found
(are you missing a using directive or an assembly reference?)

This is a very basic thing but I can't figure out why it is happening.
Does anyone know?

Thanks for your help.

Nov 19 '05 #2
Karl Seguin wrote:
add using System.Configur ation atop your file

Karl

=============== =============== ============
That worked. Thanks.
Nov 19 '05 #3

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

Similar topics

6
2457
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 will use a specifically named key from their respective web.config's. I want the control to use that key regardless of which application it's being used on. How can I get that key from the application? I considered creating a config file for the...
0
1093
by: awf_ng | last post by:
I'm writing a MMC snapin in .NET. The problem I have is that I need to access configuration information, which needs to be stored in the App.config file. Being a MMC snapin, if I use the ConfigurationSettings class it's looks for the configuration file MMC.exe.config in my System32 folder rather than a config file for the snapin itself. What I'd like it to do is to access a file <snapin assembly>.dll.config but still use the...
2
6402
by: Mythran | last post by:
public static void Main() { string sectionName = "system.web"; object settings = ConfigurationSettings.GetConfig(sectionName); Console.WriteLine( settings == null ? "(null)" : settings.GetType().ToString() ); }
1
1419
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 (string key in ConfigurationSettings.AppSettings.Keys) { Application = ConfigurationSettings.AppSettings; }
3
1543
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 every time I access it. I want to define the connection string in the web app ConfigurationSettings and let the class library reference it itself whenever it needs a connection. How can I do this?
3
1056
by: Andrew Fisher | last post by:
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?
1
1900
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: (1) Parser Error Message: </b>The XML file c:\windows\microsoft.net\framework\v1.1.4322\Config\machine.config could not be loaded. Attempted to access an unloaded AppDomain. (2) Parser Error Message: </b>The XML file...
5
12515
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 name of the DLL that is calling it as per a Windows EXE ie : myexe.exe.config. I have named my Xml file mydll.dll.config where mydll is the name of my class library, but it doesn't seem to work. The config file is correct ie:
1
5811
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 key="company" value="Hyundai" /> <add key="Hyundai" value="sonata" />
0
8251
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8688
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8635
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8494
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7178
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6115
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5570
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4085
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2614
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.