Migrating from ASP to ASP.NET - Language Support
(Page 5 of 11 )
Language Support
One of the most notable changes from ASP to ASP.NET is the way code executes when a page (now called a Web form) is requested on the server. ASP.NET no longer relies on scripting languages such as VBScript to execute code. In fact, you can’t use VBScript (or any scripting language for that matter) within an ASP.NET Web form. Instead, all code must be written using a .NET language and then compiled into a file referred to as an assembly. This provides faster page execution times and greater scalability since the compiled code provides a “roadmap” for the execution engine. It also allows many errors to be identified during the compilation process rather than at run-time.
The language used to write ASP.NET Web forms varies greatly from person to person. Currently the .NET Framework supports over 24 different languages ranging from VB.NET to Cobol.NET to Eiffel. While this language choice may sound enticing, in reality you’ll probably choose one of the more mainstream languages such as VB.NET or C# depending upon your background. If you come from a Visual Basic or VBScript background, VB.NET will likely be your language of choice. If you come from a C++, C, Java, or J++ background, then C# may be better suited for you.
Figure 1 provides a simple example of VB.NET and C# code that would be executed when an ASP.NET page first loads. Notice that the code is strongly-typed which provides better performance and stability, and makes code less error-prone.
VB.NET Code:
Public Sub Page_Load
(ByVal sender as Object, _
ByVal e as EventArgs)
‘Hit when the ASP.NET Web form first loads
End Sub
C# Code:
public void Page_Load (object sender, EventArgs e) {
//Hit when the ASP.NET Web form first loads
}
Figure 1. VB.NET and C# are two of the mainstream .NET languages used to create ASP.NET Web applications. The code shown here is executed each time an ASP.NET page is requested on the Web server.
Code Compilation
As code within an ASP.NET Web form is compiled (using built-in language compilers), a special type of code called Microsoft Intermediate Language (MSIL) is generated within the assembly (the .dll file created by the compiler). As its name implies, MSIL is an intermediate language that is recognized by the Common Language Runtime (CLR). When an ASP.NET page is first executed, MSIL is automatically converted into native machine code using the CLR’s Just-in-Time compiler, which provides optimal performance of the code. Figure 2 demonstrates the compilation process.

Figure 2. All .NET language code (C#, VB.NET, etc.) is compiled into Microsoft Intermediate Language (MSIL). When an ASP.NET page is first requested, the MSIL is converted into native machine code by the CLR’s Just-in-Time compiler.
Next: Server Controls >>
More ASP.NET Articles
More By Dada Kalander