Migrating from Classic ASP to ASP.NET - equivalent objects and classes

Having spent some time familiarising oneself with the objects available in Classic ASP, it can be tricky sometimes to find the .NET framework equivalent. Here's a guide.

Classic ASP .NET Framework
Scripting.FileSystem System.IO
MSXML3.ServerXmlHttp System.Net.HttpWebRequest
CDO System.Net.Mail
Scripting.Dictionary System.Collections
ADODB.Connection[1] System.Data.SqlClient.SqlConnection
System.Data.OleDb.OleDbConnection
System.Data.Odbc.OdbcConnection
ADODB.Command[2] System.Data.SqlClient.SqlCommand
System.Data.OleDb.OleDbCommand
System.Data.Odbc.OdbcCommand
ADODB.RecordSet[3] System.Data.DataSet
System.Data.DataTable
System.Data.DataReader
rs.NextRecordSet[4] DataSet.DataTables(1)
DataReader.NextResult
Command.Execute[5] Command.ExecuteScalar
Command.ExecuteReader
Command.ExecuteNonQuery
Scripting.TextStream System.IO.SteamWriter
Response[6] HttpContext.Current.Response
Request HttpContext.Current.Request
Application HttpContext.Current.Application
Session HttpContext.Current.Session

[1] In ADO.NET, the Connection object is provider specific, unlike the generic ADO Connection object
[2] In ADO.NET, the Command object is provider specific, unlike the generic ADO Command object
[3] There is no real equivalent to a RecordSet object in ADO.NET. The DataSet is a disconnected in-memory container for data, which is held in DataTables. The DataReader is akin to a forward-only, read-only RecordSet.
[4] Methods and collection of the Response, Request, Session, Application etc objects can be referenced in ASP.NET in exactly the same way as in Classic ASP, where the reference is within the web form derived from Page. If the flow of control leaves this area, the static property Current on the HttpContext class can be used. This can be seen where the current page's querystring values are referenced from a static method in this nugget of code for paging articles.
[5] ExecuteScalar returns a one row, one column result. Usually used with aggregates like SELECT Count(ID) AS TheCount. ExecuteReader is used to return a DataReader containing the records to be processed. ExecuteNonQuery is used for INSERT, UPDATE and DELETE operations where no return value is expected.
[6] Multiple RecordSets returned in a DataSet occupy separate DataTables. The DataTables can be iterated over using their ordinal index. The DataReader offers a NextResult method which moves to the, well, next result.

Date Posted:
Last Updated:
Posted by:
Total Views to date: 17669

1 Comment

- syam

Good work. Very usefull information for .net beginner who knows classic ASP like me. Thank you.

Recent Comments

Borut Spanovic 5/29/2015 11:28 AM
In response to Using ASP.NET Identity with Razor Web Pages
From this great tutorial is past a lot of time. I wonder is something change for WebMatrix - is it...

Ansuya 5/29/2015 8:24 AM
In response to Displaying Google Analytics Data in ASP.NET
Above code is not working....

Joseph Casey 5/28/2015 7:51 PM
In response to ASP.NET MVC 5 with EF 6 - Working With Files
Can you explain or provide a resource as to what is happening here? public enum FileType { =...

cesar 5/28/2015 4:56 PM
In response to Scheduled Tasks In ASP.NET With Quartz.Net
When the application pool recycle then the quartz scheduler is also destroyed, how do we keep it are...

Steve 5/28/2015 4:44 PM
In response to MVC 5 with EF 6 in Visual Basic - Reading Related Data
On this page under the section "Disable lazy loading before serialization" , the "Advanced Scenarios...

Manie Verster 5/28/2015 9:39 AM
In response to MVC 5 with EF 6 in Visual Basic - Implementing Inheritance
Sorry Mike but on my project when run it does not show the hire date and/or enrollment date. I the I...

Joseph Casey 5/27/2015 3:17 PM
In response to ASP.NET MVC 5 with EF 6 - Working With Files
Probably should have read the title. Couldn't use it with Visual Studios 2013. =[...

jean 5/27/2015 8:41 AM
In response to iTextSharp - Drawing shapes and Graphics
hey Mike, I read your arcticle about drawing on PDF with ITextSharp, it was really interesting !...

Alexandros L 5/26/2015 10:50 PM
In response to Entity Framework 6 Recipe - Hierarchical Data Management
You are a live saver.. thank you so much......

saurabh rao 5/26/2015 1:03 PM
In response to ASP.NET MVC 5 with EF 6 - Working With Files
Hey Mike ! Great article ...the code worked flawlessly for me. Didn't have any issues executing it ....