Web Configuration files in asp.net

There is an advantage in ASP.NET of grouping individual pages together into an application is that we can set values to all these pages at one shot.That is by setting the properties of the application.The setting of values for the properties of an application that will control the application at runtime is known as configuring the ASP.NET application.

For eg , consider that we want to set the session state timeout property to 10 minutes.We can very well do this using the IIS snap-in of the MMC.Howerver,this would require the web server to restart for the changes to take effect.This is how configurration was done in the ages of ASP 3.0 and below.However,with ASP.NET coming into the picture configuration management has been drastically simplified.In ASP.NET all that we need to do to configure an application,is to create a configuration file called web.config and place it in the root directory of the application.The settings that we have provided in this file are applied through out the application including its sub-directories.This web.config is an XML based file.A web.config file that sets the session state time out property for the application would look like as shown in following example :-

<configuration>
<system.web>
<sessionState timeout ="10"/>
</system.web>
</configuration>

Additionally,in the days prior to ASP.NET,moving an application from one server to another was a cumbersome process.Not only all the files had to be copied but also all the controls and components had to be registered in the registry.With ASP.NET,doing the same is as simple as performing XCOPY operation (copying all the files along with their directory structure).ASP.NET provides you with configuration files to customize your website and also to push it to the edge of the envelope for your applications.However,the major advantage of using configuration files lies in the flexibility it has to offer to developers.Applications that makes full use of configuration files need not have information (that varies often) hard coded intothe code.This makes the web application more flexibilties as if enables the web admintrator to customize the values even after developing the application.Addtionaly,it provides a herarchical configuration infrastructure that enables extensible configuration data to be defined and throughoutan application,site or machine.

Enjoyed this post? Share it!

 

Leave a comment

Your email address will not be published.