What does AspCompat="true" mean and when should I use it?



What does AspCompat="true" mean and when should I use it?..

Answer / swapna

AspCompat is an aid in migrating ASP pages to ASPX pages.
It defaults to false but should be set to true in any ASPX
file that creates apartment-threaded COM objects--that is,
COM objects registered ThreadingModel=Apartment.

That includes all COM objects written with Visual Basic
6.0. AspCompat should also be set to true (regardless of
threading model) if the page creates COM objects that
access intrinsic ASP objects such as Request and Response.
The following directive sets AspCompat to true:


<%@ Page AspCompat="true" %>
Setting AspCompat to true does two things. First, it makes
intrinsic ASP objects available to the COM components
by placing unmanaged wrappers around the equivalent ASP.NET
objects.

Second, it improves the performance of calls that the page
places to apartment- threaded COM objects by ensuring that
the page (actually, the thread that processes the request
for the page) and the COM objects it creates share an
apartment.

AspCompat="true" forces ASP.NET request threads into single-
threaded apartments (STAs). If those threads create COM
objects marked ThreadingModel=Apartment, then the objects
are created in the same STAs as the threads that created
them. Without AspCompat="true," request threads run in a
multithreaded apartment (MTA) and each call to an STA-based
COM object incurs a performance hit when it's marshaled
across apartment boundaries.

Do not set AspCompat to true if your page uses no COM
objects or if it uses COM objects that don't access ASP
intrinsic objects and that are registered
ThreadingModel=Free or ThreadingModel=Both.

Is This Answer Correct ?    3 Yes 1 No

Post New Answer

More ASP.NET Interview Questions

Explain Authentication mechanism in dotnet

0 Answers   BirlaSoft,


Explain exception handling in .net.

0 Answers  


To redirect the user to another page which method do we use without performing a round trip to the client?

0 Answers   Siebel,


How to do parallel database export in remote SQL Server in ESSL time track. It is working for local server but not working for remote SQL Server

0 Answers   CTPL,


Is sql backend or frontend?

0 Answers  






What does aspnet_regiis -i do ?

1 Answers  


what is caching,session? when & what is used mostly in which situtations, how they r implemented in real time? tell with example?

1 Answers   Satyam,


What are the session management techniques asp net?

0 Answers  


What are the new login controls in asp.net 2.0?

0 Answers  


What is voluum?

0 Answers  


if i have a web page, and after the postback i dont to maintain the viewstate. How can we maintain in web application?

4 Answers   CGI,


How can I configure asp.net applications that are running on a remote machine?

0 Answers  


Categories