Retrieving applicationSettings values in an ASP.NET app

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)?
 
K

Karl-Inge Reknes

//web.config
<appSettings>
<add key="SistOppdatert" value="04.11.2008" />
</appSettings>
//C# code
NameValueCollection appSettings = ConfigurationManager.AppSettings;
label1.text = appSettings["SistOppdatert"];
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top