ASP and ASP.NET are the two known widely used languages to develop web pages. These are great to build websites and web applications. Typically, legacy applications were developed in classic ASP using VBScript and MS Access database as the backend data source. Microsoft Corporation has done tremendous efforts to migrate applications from classic ASP to ASP.NET and MS Access Database to MS SQL Server.
ASP or Active Server Page is the first web technology released by Microsoft in 1996. It was released as a part of IIS (Internet Information Manager) 3.0. Later, two more versions were released named as 2.0 and 3.0. ASP 3.0 has major advancements like better performance and buffering, transfer and server execute methods.
ASP.NET is the successor to classic ASP language. IIS 6.0 supports it and it allows developer to create application, websites and we services using .NET framework. It is built on Common Language Runtime.
Compilation and Interpretation
In contrast to the ASP, ASP.NET code is always compiled first into .NET classes of the assemblies. The class can contain the server side code and static HTML in it. All the requests are served by executing the compiled code, which is the reason it became popular as it eliminates the underlying inefficiencies of the classic ASP technology.
ASP.NET supports the languages of classic ASP. Furthermore, you can also use C# and VB.NET languages. It has a code-behind file that supports only one server side scripting language to be compiled and parsed by the framework. You can create custom controls by using @directive.
Object Oriented Programming and Database Transactions
In ASP, there is no concept of Object Oriented Programming. It has a simple COM object to support the functionality of accessing a database.
You can implement the principles of Object Oriented Programming. It supports the XML integration from multiple data sources and has ADO.NET to read and write data into database.
You can only run ASP when you are running IIS as the application runs under the process of inetinfo.exe. If an IIS is crashed or paused, your ASP application will immediately stop working.
ASP.NET runs under the process of distinct of IIS aspnet_wp.exe. If you stop the IIS, it will not affect the ASP.NET application and ensures the stability of your application.
You can debug your code easily as there are many tools available in the .NET framework. In ASP.NET, C# and VB.NET, both are strong typed languages and will not be complied if there is any compilation error.
Let us take an example of each technology, which will display the selected columns from the table company having ID 100 or above from external databases.
<html> <body> <!- - opening of server script tag --> <% set connect = Server.CreateObject( "ADODB.Connection" ) connect.Provider = "Microsoft.Jet.OLEDB.4.0" connect.Open( Server.Mappath ("/db/northwind.mdb") ) set rs = Server.CreateObject("ADODB.recordset") sql = "SELECT CompanyID, CompanyName, ContactName, RegistrationDate FROM Customers WHERE CompanyID > = 100" rs.Open sql, connect %> <!- - ending of server script tag --> <table border="1" width="100%"> <tr> <%for each x in rs.Fields response.write("<th>" & x.name & "</th>") next%> </tr> <!—print until reach end of file--> <%do until rs.EOF%> <tr> <%for each x in rs.Fields%> <td><%Response.Write(x.value)%> </td> <%next rs.MoveNext%> </tr> <%loop rs.close conn.close %> </table> </body> </html>
|<!- – opening of server script tag –>
var db = Database.Open(“CustomersDB”);
var query = sql = “SELECT CompanyID, CompanyName, ContactName, RegistrationDate FROM Customers WHERE CompanyID >= 100 “;
}<!- – ending of server script tag –>
<h1>Small Bakery Products</h1>
<table border=”1″ width=”100%”>
<!- – Iteration on results –>
@foreach(var row in db.Query(query))