Retrieving applicationSettings values in an ASP.NET app

  • Thread starter Thread starter Susan Harris
  • Start date Start date
S

Susan Harris

I am creating an ASP.NET website using VS2008. I have added some values in
the Web.config (using the VS2008 UI - so they are under
applicationSettings). In a Winforms app, I'd get at these using
Properties.Settings.Default..., but I can't see to use this in a class I
created under the App_Code directory.

Is there any alternative method used when pulling settings values from
Web.config (compared to App.config)?
 
//web.config
<appSettings>
<add key="SistOppdatert" value="04.11.2008" />
</appSettings>
//C# code
NameValueCollection appSettings = ConfigurationManager.AppSettings;
label1.text = appSettings["SistOppdatert"];
 
Back
Top