Performance Issues when Migrating from ASP to ASP.NET

When migrating ASP applications to ASP.NET, you should be aware of the potential performance issues associated with the following subjects:

  • **Calls to unmanaged code   **Managed-code calls to unmanaged components incur a marshaling cost and can noticeably affect performance. For best performance, COM components should be rewritten in managed code using a runtime-compatible language. If this is not possible, try reducing the number of calls between the managed and unmanaged boundary, with your code doing more work between calls. For more information, see Interoperating with Unmanaged Code.

  • Late binding   ASP used the CreateObject method to create an object of indeterminate type, as shown in the following example:

    SampleObject = Server.CreateObject("ProgId")

    This type of declaration works with ASP.NET, but for best performance, the type of object should be declared when it is created:

    Dim SampleObject As New ObjectType()
    ' or
    ' Dim SampleObject As ObjectType = New ObjectType()
    ObjectType SampleObject = new ObjectType();

    Note that you must use the Tlbimp.exe utility in order to import the type into your page before declaring early-bound COM objects.

See Also


COM Component Compatibility

Other Resources

Developing High-Performance ASP.NET Applications

Interoperating with Unmanaged Code