10.2. Web.config

One of the aspects of ASP.NET that irritated me was how bloated Web.config files had become. To some extent, this bloat was because of ASP.NET 3.0 and 3.5 using version 2 of the CLR, and in order to introduce additional functionality, Microsoft had to override default settings, as well as cope with different versions of IIS (that is, settings for IIS 7.0 and settings for earlier versions).

.NET 4.0, however, has a new version of the CLR, so this is no longer a problem. Several settings have been moved to Machine.config, which drastically reduces the size of Web.config. Functionality such as ASP.NET charting, dynamic data, Ajax, and routing is now also automatically registered for you and so no longer has to be added to the Web.config file. Some developers may not like this addition of functionality that they may not use, but for the majority, it will save a bit of configuration and can be overridden in Machine.config.

What follows is the default Web.config file that is generated for an ASP.NET 4.0 empty web project (the standard ASP.NET project has a larger Web.config file because it contains authentication and membership stuff as well):

<?xml version="1.0"?>
<configuration>
    <system.web>
        <compilation debug="true" targetFramework="4.0" />
    </system.web>
    <system.webServer>
      <modules runAllManagedModulesForAllRequests="true"/>
    </system.webServer>
</configuration>

That's much better.

MULTITARGETING SUPPORT

Please refer to Chapter 2 for details of multitargeting changes that will affect ASP.NET developers. ASP.NET developers should be aware that VS2010 has two versions of the development web server: one for .NET 2.0 and the other for .NET 4.0 applications.


..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.188.191.11