Simplified web.config files
This is a translation of the first article in the Scott Guthrie series of articles about VS 2010 and .NET 4.0. Personally, I know something about what will happen next and I dare to assure you, there will be a lot of interesting things about changes in .NET 4.0, ASP.NET 4.0 and VS2010. Wait for new articles and subscribe to the ScottGu blog RSS feed.
This is the first article in the cycle of articles I planned for expected VS 2010 and .NET 4.
This article will be small, but it seems to me that it describes a very useful change that will be in ASP.NET 4.0: simple and abbreviated web.config files.
You will encounter this change for the first time when you create a new empty ASP.NET 4.0 Web application project in Visual Studio 2010 through File-> New Project (this is why I took this topic for the first article).
Web.config files in .NET 3.0 and 3.5
With each subsequent release of .NET, the web.config files included in ASP.NET projects increased in size. For example: the web.config file used by default when creating a new project in Visual Studio 2008 SP1 has grown to 126 lines that contain everything from section descriptions to handler definitions and modules that are included in the ASP.NET processing mechanism of http requests.
')
This increase in size occurs because .NET 3.0 and .NET 3.5 use the same CLR and machine.config configuration file that were included in .NET 2.0 — and therefore simply add or update assemblies during installation. To avoid the risk of inadvertently overwriting user preferences in the original machine.config 2.0 file, we did not register the definitions of partitions, handlers, and modules that appeared with the release of .NET 3.0 and 3.5 in machine.config. Instead, we by default registered all this data in the application local web.config file. This is safer, but has resulted in web.config files growing in size and becoming hard to read.
Web.config files in .NET 4
.NET 4 contains a new version of the CLR and a new .NET 4 specific machine.config file (which is installed next to the existing file for .NET 2, .NET 3, and .NET 3.5).
The new machine.config file for .NET 4 now automatically registers all sections of ASP.NET, handlers and modules that we added year after year, including functionality for:
* ASP.NET AJAX
* ASP.NET Dynamic Data
* ASP.NET Routing (a mechanism that can be used for both ASP.NET WebForms and ASP.NET MVC)
* ASP.NET Chart Control (which will now be built into the ASP.NET V4 package)
All these changes mean that when you create a new project “Empty ASP.NET application” in VS 2010, you will see the new simplified and reduced web.config used by default in the application:
The first section of the configuration tells ASP.NET that debugging should be enabled for the application by default and indicates the version of .NET that Visual Studio should target during the operation of the intelliSense mechanism (VS2010 supports multi-purpose development, so the intelliSense in the IDE will automatically adjust under the version of the framework that you specify).
The second section of the configuration indicates whether you need to use the “integrated” mode during the launch of an ASP.NET application on IIS7. This setting determines whether all ASP.NET HttpModules should be run for all requests to the application or only for URLs specific to ASP.NET. We set this value to true, allowing the default mechanism for new ASP.NET applications, since for compatibility reasons, the IIS7 settings are set by default so that ASP.NET modules HttpModules are only launched for ASP.NET specific URLs (and not for all requests).
Conclusion
The simplified web.config file is a small change, but despite this, I think that this change will make your work with creating ASP.NET projects from scratch a bit more convenient and accessible.
In subsequent articles, I will stay on many other more important improvements that will appear in ASP.NET 4 (but small and nice things will be too).
I hope this article was useful to you,
Scott