View Full Version : Accessing Keys in the appSection of Web.Config

01-31-2005, 04:13 AM
I am trying to store some information (like application paths) in the web.config file of my ASP
C# project. To that end I did the following:

?xml version="1.0" encoding="utf-8" ?>
<add key="ApplicationDir" Value="C:\Application"/>
<add key="DatabaseDir" Value="\Database\"/>
<add key="UpdateDir" Value="\UpdatePackages\"/>

...(lot of stuff that was generated automatically)...

Note that I manually added the <appSettings> field (it was not automatically there), is it possible I placed it in the wrong part of the web.config file?

string appDir = ConfigurationSettings.appSettings["ApplicationDir"];
string updDir = ConfigurationSettings.appSettings["UpdateDir"];
string SaveLocation = appDir + updDir + fn;

I use this code to create the SavePath for uploaded Update Files.
However, on compile, I get the following error:
The type or namespace name 'ConfigurationSettings' could not be found (are you missing a using directive or an assembly reference?)
Nothing appears in VC# when I type ConfigurationSettings. (should give me a list of choices)

Any clues why?
Is it because I added it manually and need to add something else to the XML file?

02-01-2005, 07:37 AM
Using System.Configuration

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum