Home > ASP.NET Applications > ASP.NET Configuration > Accessing Configuration Settings
ASP.NET Web Applications ASP.NET Configuration
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:
bool nocookies = Session.Cookieless;
Dim nocookies As Boolean = Session.Cookieless |
|
C# |
VB |
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,
String dsn = ConfigurationManager.ConnectionStrings [ "dsn" ];
Dim dsn As String = ConfigurationManager.ConnectionStrings ( "dsn" ) |
|
C# |
VB |
ASP.NET Configuration Sections Format of ASP.NET Configuration Files Hierarchical Configuration Architecture
|