This documentation is archived and is not being maintained.

Optimizing Performance in 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 Server.CreateObject method to create an object of indeterminate type, as shown in the following example:

    MyObject = Server.CreateObject("ProgId")

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

    Dim MyObject As New ObjectType

    This can also be accomplished with slightly different syntax:

    Dim MyObject As ObjectType = New ObjectType

    Note that you will have to use the TlbImp utility in order to import the type into your page before declaring early-bound COM objects.

See Also

CreateObject Function | Interoperating with Unmanaged Code | Migrating ASP Pages to ASP.NET