Home > DeveloperSection > Interviews > What does the line <%@ page aspcompat=true %> actually do?

Posted on    December-11-2010 12:00 AM

 VB.Net VB.Net 
 1 Answer(s)
  1773  View(s)
Rate this:

Amit Singh

Total Post:565

Posted on    December-11-2010 1:00 AM

ASP used an STA based thread-pool optimized for apartment-threaded components. This thread-pool was managed by MTS -- which is how/why ObjectContext could be flowed to components on a page.

ASP.NET by default uses an MTA based thread-pool (enables us to do async io completions, etc). For performance reasons, we don't by default attempt to surface the old ASP COM classic intrinsics via ObjectContext. Instead, components can directly get access to the intrinsics using the HttpContext.Current static property.

 For example:
Dim Request as HttpRequest
Dim Response as HttpResponse

Request = HttpContext.Current.Request
Response = HttpContext.Current.Response

Enabling the <%@ page aspcompat=true %> switch at the top of the page does two things:

1) Causes that page to be executed on an STA thread-pool instead of the new MTA one. This optimizes performance for VB6 created apartment threaded components.

2) Causes us to surface the old ASP COM Intrinsics via ObjectContext. This will enable existing COM components built against the old ASP typelibraries to continue to work (note that if you want to get access to the new ASP.NET intrinsics -- you need to write code like the ones above).

Don't want to miss updates? Please click the below button!

Follow MindStick