ASP Configugration
ASP Configugration
NET - Configuration
Previous
Next
machine.config
web.config
The following figure shows the Solution Explorer for the sample
example used in the web services tutorial:
In this application, there are two web.config files for two projects
i.e., the web service and the web site calling the web service.
<configuration>
<section1>
<s1Setting1 attribute1="attr1" />
</section1>
<section2>
<s2Setting1 attribute1="attr1" />
</section2>
<system.web>
<authentication mode="Windows" />
</system.web>
</configuration>
<configSections>
<section />
<sectionGroup />
<remove />
<clear/>
</configSections>
Application Settings
The application settings allow storing application-wide name-
value pairs for read-only access. For example, you can define a
custom application setting as:
<configuration>
<appSettings>
<add key="Application Name" value="MyApplication"
/>
</appSettings>
</configuration>
For example, you can also store the name of a book and its ISBN
number:
<configuration>
<appSettings>
<add key="appISBN" value="0-273-68726-3" />
<add key="appBook" value="Corporate Finance" />
</appSettings>
</configuration>
Connection Strings
The connection strings show which database connection strings
are available to the website. For example:
<connectionStrings>
<add name="ASPDotNetStepByStepConnectionString"
connectionString="Provider=Microsoft.Jet.OLEDB.4.0;
Data Source=E:\\projects\datacaching\ /
datacaching\App_Data\ASPDotNetStepByStep.mdb"
providerName="System.Data.OleDb" />
<add name="booksConnectionString"
connectionString="Provider=Microsoft.Jet.OLEDB.4.0;
Data Source=C:\ \databinding\App_Data\books.mdb"
providerName="System.Data.OleDb" />
</connectionStrings>
System.Web Element
The system.web element specifies the root element for the
ASP.NET configuration section and contains configuration
elements that configure ASP.NET Web applications and control
how the applications behave.
<system.web>
<anonymousIdentification>
<authentication>
<authorization>
<browserCaps>
<caching>
<clientTarget>
<compilation>
<customErrors>
<deployment>
<deviceFilters>
<globalization>
<healthMonitoring>
<hostingEnvironment>
<httpCookies>
<httpHandlers>
<httpModules>
<httpRuntime>
<identity>
<machineKey>
<membership>
<mobileControls>
<pages>
<processModel>
<profile>
<roleManager>
<securityPolicy>
<sessionPageState>
<sessionState>
<siteMap>
<trace>
<trust>
<urlMappings>
<webControls>
<webParts>
<webServices>
<xhtmlConformance>
</system.web>
AnonymousIdentification
Authentication
<authentication mode="[Windows|Forms|Passport|None]">
<forms>...</forms>
<passport/>
</authentication>
Authorization
<authorization>
<allow .../>
<deny .../>
</authorization>
Caching
It Configures the cache settings. The basic syntax is as given:
<caching>
<cache>...</cache>
<outputCache>...</outputCache>
<outputCacheSettings>...</outputCacheSettings>
<sqlCacheDependency>...</sqlCacheDependency>
</caching>
CustomErrors
Deployment
HostingEnvironment
<hostingEnvironment idleTimeout="HH:MM:SS"
shadowCopyBinAssemblies="true|false"
shutdownTimeout="number"
urlMetadataSlidingExpiration="HH:MM:SS" />
Identity
<machineKey validationKey="AutoGenerate,IsolateApps"
[String]
decryptionKey="AutoGenerate,IsolateApps" [String]
validation="HMACSHA256" [SHA1 | MD5 | 3DES | AES |
HMACSHA256 |
HMACSHA384 | HMACSHA512 | alg:algorithm_name]
decryption="Auto" [Auto | DES | 3DES | AES |
alg:algorithm_name]
/>
Membership
Pages
<controls>...</controls>
<namespaces>...</namespaces>
<tagMapping>...</tagMapping>
<ignoreDeviceFilters>...</ignoreDeviceFilters>
</pages>
Profile
<properties>...</properties>
<providers>...</providers>
</profile>
RoleManager
<roleManager cacheRolesInCookie="true|false"
cookieName="name"
cookiePath="/" cookieProtection="All|Encryption|
Validation|None"
cookieRequireSSL="true|false "
cookieSlidingExpiration="true|false "
cookieTimeout="number of minutes"
createPersistentCookie="true|false"
defaultProvider="provider name" domain="cookie
domain">
enabled="true|false"
maxCachedResults="maximum number of role names
cached"
<providers>...</providers>
</roleManager>
SecurityPolicy
<securityPolicy>
<trustLevel />
</securityPolicy>
UrlMappings
<urlMappings enabled="true|false">
<add.../>
<clear />
<remove.../>
</urlMappings>
WebControls