You can continue to run existing ASP pages on your ASP.NET servers, convert the pages to the new format, or move COM components from ASP pages to ASP.NET pages. In this section, you learn about this level of interoperability.
Running ASP and ASP.NET Together
ASP and ASP.NET run well together on the same server ”that's a fundamental consequence of the architecture of the two systems. Internet Information Services (IIS) forwards the requests for ASP pages to asp.dll (usually present in the System32\inetsrv folder of the Windows installation directory), whereas ASP.NET pages are handled by aspnet_isapi.dll (usually present in the Microsoft .NET Framework installation directory). Thus, there's no confusion on the part of the server between the two file types, and you don't need to worry that old pages will be executed incorrectly after you install ASP.NET.
Converting ASP Pages to ASP.NET
The syntax of ASP.NET pages is very close to the syntax of ASP pages, but it's not identical. Here's a partial list of things you might need to change if you want to convert an existing ASP page to run as an ASP.NET page:
Using Late-bound COM Components
ASP.NET still supports the Server.CreateObject() method for creating late-bound COM components. For example, you can create an ADO Connection object in either an ASP page or an ASP.NET page with this line of code:
cnn = Server.CreateObject("ADODB.Connection");
Not all COM components can be instantiated in ASP.NET this way, however. In particular, components that use the Single-Threaded Apartment (STA) threading model do not function properly in ASP.NET pages unless you add a compatibility directive to the page, like so:
You should note that C# is a strongly typed language and does not allow specific operations on generic objects whose type is unknown at compile time. A solution is to invoke the methods of the generic object dynamically by calling the Type.InvokeMember() method. The InvokeMember() method uses the following five parameters:
You should consider using late-bound COM objects as only a temporary measure. Although the ASP.NET engine will execute the new page, it won't benefit from any of the new capabilities of the .NET Framework.