Accessing ASP.NET Configuration Settings
This page is specific to:.NET Framework Version:1.12.03.03.54.0
.NET Framework Developer's Guide
Accessing ASP.NET Configuration Settings

You can access public configuration settings from within an ASP.NET application by using the intrinsic static methods exposed by ASP.NET. For example, to read the value of the cookieless attribute of the <sessionState> section, you could use the following line of code.

Dim nocookies As Boolean = Session.IsCookieless
[C#]
bool nocookies = Session.IsCookieless;

Application-specific settings stored within the top-level <appSettings> section of Web.config files can be accessed using the ConfigurationSettings.AppSettings static string collection. For example:

Dim dsn As String = ConfigurationSettings.AppSettings("dsn")
[C#]
String dsn = ConfigurationSettings.AppSettings["dsn"];

See Also

ASP.NET Configuration | Configuring Applications

© 2009 Microsoft Corporation. All rights reserved.   Terms of Use | Trademarks | Privacy Statement
Page view tracker
Rate the Lightweight library
x
Lightweight builds on ScriptFree (loband) by adding features you've requested: a SearchBox and default code language selection.
Do you like the SearchBox?
Do you like the tabbed code blocks?
How useful is this topic?
Tell us more.
Thanks
x
You're helping to improve MSDN Online.
Feedback
Switch View
Classic
Lightweight Beta
ScriptFree
Switch View