Assemblies in ASP.Net

An assembly is the actual .dll file on your hard drive where
the classes in the .NET Framework are stored. For example, all the classes contained in the ASP.NET Framework are located in an assembly named System.Web.dll.
More accurately, an assembly is the primary unit of deployment, security, and version control in the .NET Framework. Because an assembly can span multiple files, an assembly is often referred to as a “logical” dll.
There are two types of assemblies: private and shared. A private assembly can be used by only a single application. A shared assembly, on the other hand, can be used by all applications located on the same server.
Shared assemblies are located in the Global Assembly Cache (GAC). For example, the System.Web.dll assembly and all the other assemblies included with the .NET Framework are located in the Global Assembly Cache.
The Global Assembly Cache is located physically in your computer’s \WINDOWS\Assembly folder.
Before you can use a class contained in an assembly in your application, you must add a reference to the assembly.
By default, an ASP.NET application references the most common assemblies contained in the Global Assembly Cache:
. mscorlib.dll
. System.dll
. System.Configuration.dll
. System.Web.dll
. System.Data.dll
. System.Web.Services.dll
. System.Xml.dll
. System.Drawing.dll
. System.EnterpriseServices.dll
. System.Web.Mobile.dll
In addition, websites built to target the .NET Framework 3.5 also reference the following assemblies:
. System.Web.Extensions
. System.Xml.Linq
. System.Data.DataSetExtensions
You can target a website to work with the .NET Framework 2.0, .NET Framework 3.0, or.NET Framework 3.5. Within Visual Web Developer, select the menu option Website,Start Options and select the Build tab. You can select the framework to target from a dropdown list.
To use any particular class in the .NET Framework, you must do two things. First, your application must reference the assembly that contains the class. Second, your application must import the namespace associated with the class.
In most cases, you won’t worry about referencing the necessary assembly because the most common assemblies are referenced automatically. However, if you need to use a specialized assembly, you need to add a reference explicitly to the assembly. For example, need to interact with Active Directory by using the classes in the System.DirectoryServices namespace, then you will need to add a reference to the System.DirectoryServices.dll assembly to your application.
Each class entry in the .NET Framework SDK documentation lists the assembly and namespace associated with the class. For example, if you look up the MessageQueue class in the documentation, you’ll discover that this class is located in the System.Messaging namespace located in the System.Messaging.dll assembly.
If you are using Visual Web Developer, you can add a reference to an assembly explicitly by selecting the menu option Web Site, Add Reference, and selecting the name of the assembly that you need to reference. For example, adding a reference to the System.Messaging.dll assembly results in the web configuration file added to your application.

Web.Config:-
configuration
system.web
compilation
assemblies
add assembly=”System.Messaging, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A”/
/assemblies
/compilation
/system.web
/configuration


Related Topic:






Tags: , , , , , ,
Hot on Web:


About author