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: 17804

1 Comment

- syam

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

Recent Comments

Justin Kusuma 7/24/2015 3:38 AM
In response to Posting Data With jQuery AJAX In ASP.NET Razor Web Pages
Hi Mike, thanks much for sharing such an article :) Really help me a lot... further, I'd like to...

Michael Easterbrook 7/22/2015 5:35 PM
In response to Inline Razor Syntax Overview
I removed the @ symbols and I am still getting the same error. It only occurs when I have an "if" a...

Sujay 7/22/2015 1:36 PM
In response to ASP.NET MVC, Entity Framework, One-to-Many and Many-to-Many INSERTS
can you explain how to link two tables so that it forms many to many relationship?(Article and...

Max G 7/21/2015 9:29 PM
In response to Scheduled Tasks In ASP.NET With Quartz.Net
Hi, I've opted for this solution in one of my applications but i've found that the apppool is and I...

Michael Easterbrook 7/20/2015 4:31 PM
In response to Inline Razor Syntax Overview
When I have the following code: @foreach (var procRow in procRowDecade) { if (@procRow[3] +...

Shanice 7/18/2015 10:58 PM
In response to A Better Way To Export Gridviews To Excel
Hi. I'm working with mvc. I need to add the above code in the business logic layer, however the...

Matt 7/18/2015 6:29 PM
In response to Nested Layout Pages with Razor
Cheers sir, nice explanation :)...

Keshavan 7/17/2015 9:06 AM
In response to Scheduled Tasks In ASP.NET With Quartz.Net
Hi Mike, I have followed exactly as illustrated in blog, I get error "StdSchedulerFactory.cs" not...

Paul Thiel 7/16/2015 5:17 PM
In response to ASP.NET 5 By Numbers
Comments Below: "The new version of ASP.NET is called ASP.NET 5. It is a framework for developing...

saket singh 7/16/2015 8:42 AM
In response to Scheduled Tasks In ASP.NET With Quartz.Net
hi Mike, great tutorial on Quartz.net , but i have One Problem , Everything is working fine as as...