Complete section and setting in web.config file

This article contain complete explanation of section and setting of web.config file. This is quick reference for those who just started to learn ASP.Net. Its a first step to start designing web application. Find section and setting of web.config file. Learn ASP.Net with quick reference.

Learn ASP.Net quick reference and complete section & setting in web.config file

Detail description of web.config file:
1) web.config file stored in xml format .
2) You can add any number of config file in your application .
3) web.config file inherits from root web.config which is store at location
"systemroot\Microsoft.NET\Framework\versionNumber\CONFIG\Web.config "

NO we start with section inside web.config file

A) Compilation setting :

debug="true" strict="true" explicit="true" batch="true"
optimizeCompilations="true" batchTimeout="900"
maxBatchSize="1000" maxBatchGeneratedFileSize="1000"
numRecompilesBeforeAppRestart="15" defaultLanguage="c#"
targetFramework="4.0" assemblyPostProcessorType="">
<add assembly="System, Version=1.0.5000.0, Culture=neutral,


Compilation seeetting is used to enable debugging mode of application
Assembly - used to add assembly from GAC (Global assembly cache)
public key token - generated from visual command prompt using following command

sn –T DllName.dll

B) Page Setting :

in Page setting we can set session state , view State and buffer of asp pages .

<pages buffer ="true" styleSheetTheme=""
masterPageFile ="MasterPage.master"

C) Custom Error Setting :
we can configure Application error using custom error setting section

<customErrors defaultRedirect ="ErrorFile.aspx" mode ="Off">
<error statusCode ="404" redirect ="FileNotFound.aspx"/>

Default redirect - if page gets error File not found then it will automatically redirect on specified url .
Status code -code of error like 400-bad request
405 -File not found

D) Location Setting :
this is used to set path of different folder and subfolder .

<location path="Default.aspx">
<allow users="*"/>

E) Session State and View State Setting : is a stateless so we have to maintain state by using Session and view state . it's a local storage in

View state enable or disable from here :

<Pages EnableViewState="true" />

following is used for session :

<sessionState mode="SQLServerCon" sqlConnectionString="Connection" />

F) Httphandler Setting:
when request for resource is send to server that request has been executed by Httphandler

G) HttpModuleHandler Setting :

HttpModule is a class or an assembly that implements the IHttpModule interface that handles the application events or user events.

I)AppSetting : mostly used tag from web.config file is AppSettting .
its used to stored application information such as connection string , File path .
it is in key value pair format . In application you can retrieve any value by knowing its key value .

<add key="imagepath" value="D:\image.jpg"/>

For connection string :

<add name ="cnn" connectionString ="Initial Catalog = Test;
Data Source =localhost; Integrated Security = true"/>

please post on resource if you want more details regarding web.config file .

Thanks and Regards
Sagar Pawar


No responses found. Be the first to comment...

  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name: