Online Book Reader

Home Category

Programming Microsoft ASP.NET 4 - Dino Esposito [98]

By Root 5521 0
can be found in the root web.config file of the Web server machine. The list is pretty long in ASP.NET 4, but it no longer includes the System.Web.Mobile assembly that was there for older versions of ASP.NET. The mobile assembly is now deprecated, but if you’re trying to upgrade an existing application to ASP.NET 4 that uses the assembly, you are required to add the assembly explicitly via an @Assembly directive or via a custom section in the application.

Table 5-7 lists some of the assemblies that are automatically provided to the compiler for an ASP.NET 4 application.

Table 5-7. Assemblies Linked by Default in ASP.NET 4

Assembly File Name

Description

mscorlib

Provides the core functionality of the .NET Framework, including types, AppDomains, and run-time services

System.dll

Provides another bunch of system services, including regular expressions, compilation, native methods, file I/O, and networking

System.Configuration.dll

Defines classes to read and write configuration data.

System.Core.dll

Provides some other core functionality of the .NET Framework, including LINQ-to-Objects, the time-zone API, and some security and diagnostic classes

System.Data.dll

Defines data container and data access classes, including the whole ADO.NET framework

System.Data.DataSetExtensions.dll

Defines additional functions built over the ADO.NET DataSet object

System.Drawing.dll

Implements the GDI+ features

System.EnterpriseServices.dll

Provides the classes that allow for serviced components and COM+ interaction

System.Web.dll

Indicates the assembly implements the core ASP.NET services, controls, and classes

System.Web.ApplicationServices.dll

Provides classes that enable you to access ASP.NET authentication, roles, and profile functions via a bunch of built-in WCF services

System.Web.DynamicData.dll

Provides classes behind the ASP.NET Dynamic Data framework

System.Web.Entity.dll

Contains the code for the EntityDataSource component that supports Entity Framework

System.Web.Extensions.dll

Contains the code for AJAX extensions to ASP.NET

System.Web.Services.dll

Contains the core code that makes Web services run

System.Xml.dll

Implements the .NET Framework XML features

System.Xml.Linq.dll

Contains the code for the LINQ-to-XML parser

Note that you can modify, extend, or restrict the list of default assemblies by editing the global settings in the root web.config file under

%Windows%\Microsoft.NET\Framework\v4.0.30319\Config

If you do so, changes will apply to all ASP.NET applications run on that Web server. Alternatively, you can modify the assembly list on a per-application basis by editing the section under in the application’s specific web.config file. Note also that the section should be used only for global assembly cache (GAC) resident assemblies, not for the private assemblies that you deploy to the Bin folder.

By default, the section in the root web.config file contains the following entry:

It means that any assembly found in the binary path of the application should be treated as if it were registered through the @Assembly directive. To prevent all assemblies found in the Bin directory from being linked to the page, remove the entry from the root configuration file. To link a needed assembly to the page, use the following syntax:

<%@ Assembly Name="AssemblyName" %>

<%@ Assembly Src="assembly_code.cs" %>

The @Assembly directive supports two mutually exclusive attributes: Name and Src. Name indicates the name of the assembly to link to the page. The name cannot include the path or the extension. Src indicates the path to a source file to dynamically compile and link against the page. The @Assembly directive can appear multiple times in the body of the page. In fact, you need a new directive for each assembly to link. Name and Src cannot be used in the same @Assembly directive, but multiple directives defined in the same page can use either.

Note

In terms of performance,

Return Main Page Previous Page Next Page

®Online Book Reader