ASP.NET Compiler

All ASP.NET code is compiled, which enables strong typing, performance optimizations, and early binding, among other benefits. Once the code has been compiled, the common language runtime further compiles ASP.NET code to native code, providing improved performance.

ASP.NET includes a compiler that will compile all your application components including pages and controls into an assembly that the ASP.NET hosting environment can then use to service user requests.

In order for application code to service requests by users, ASP.NET must first compile the code into one or more assemblies. Assemblies are files that have the file name extension .dll. You can write ASP.NET code in many different languages, such as Visual Basic, C#, J#, and others. When the code is compiled, it is translated into a language-independent and CPU-independent representation called Microsoft Intermediate Language (MSIL). At run time, MSIL runs in the context of the .NET Framework, which translates MSIL into CPU-specific instructions for the processor on the computer running the application.

There are many benefits to compiling application code including:
  • Performance Compiled code is much faster than scripting languages such as ECMAScript or VBScript because it is a closer representation to machine code and does not require additional parsing.
  • Security Compiled code is more difficult to reverse engineer than non-compiled source code because it lacks the readability and abstraction of a high-level language. Additionally, there are obfuscation tools that make compiled code even more resistant to reverse engineering.
  • Stability Code is checked at compile time for syntax errors, type safety, and other problems. By catching these errors at build-time you can eliminate many errors in your code.
  • Interoperability Because MSIL code supports any .NET language, you can use assemblies that were originally written in other languages in your code. For example, if you are writing an ASP.NET Web page in C#, you can add a reference to a .dll file that was written in Visual Basic.
Automatic Compilation

ASP.NET automatically compiles your application code and any dependent resources the first time a user requests a resource from the Web site. In general, ASP.NET creates an assembly for each application directory (such as App_Code) and one for the main directory. (If files in a directory are in different programming languages, then separate assemblies will be created for each language.) You can specify which directories are compiled into single assemblies in the Compilation section of the Web.config file.
Tags: ,
Hot on Web:


About author