Visual Studio 2010 clean application level web.config

This post introduces you to a small improvement that has been made in Visual Studio 2010 & .NET 4 to reduce the size of the ASP.NET application level web.config

3.0 and 3.5 web.config

As ASP.NET technology evolved, the application level Web.config had new things added to it. Since the earlier frameworks were using the same set of machine level configuration files, incremental feature that was added subsequent to the 2.0 release resulted in additional config settings included in the file.

.NET 4 web.config

With .NET 4, the web.config is tremendously reduced in size to improve the simplicity  of ASP.NET

The config settings have been moved down to the machine config file. This includes registers all of the ASP.NET tag sections, handlers, modules and settings for the following:

  • ASP.NET AJAX
  • ASP.NET Dynamic Data
  • ASP.NET Routing
  • ASP.NET Chart Control

You can look at the trimmed down web.config by creating a .Net 4 ‘ASP.NET Empty Web Application’ in Visual Studio 2010.

Following is the web.config file for .NET 4 C# ‘ASP.NET Empty Web Application':

 

 image

The config file above has settings to tell ASP.NET to enable debugging by default for the application and provides the version of .NET framework to use.(Please read the post http://blogs.msdn.com/webdevtools/archive/2009/09/30/visual-studio-2010-property-grid-filtering.aspx to find out why targetFramework version attribute should not be updated manually)

 

Hope this helps,

Deepak Verma | Visual Web Developer