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

How does the iis work?

0 Answers  


Describe the differences between the lifecycles of Windows services and Standard EXE?

0 Answers   Siebel,


what is the difference between sql 2000 and 2005?

2 Answers   Cognizant,


Explain how asp.net different from asp?

0 Answers  


what is the use of asp.net

3 Answers   ABC,






Should user input data validation occur server-side or client-side? Why?

3 Answers   NIC, Siebel Systems,


what is session ?how sessions are handeled in application? write the clauses of sql server in their order.

3 Answers   Olive Tech,


After building the custom control, you test it by adding an ASP.Net web application to the solution. You add a correct <%@ Register %> directive and a proper declaration of the control in the <asp:Form> tag to the Web Form, but when you execute the application you get an error. What is the most likely reason for the problem? a) The custom control must be compiled first. b) The web application must have a reference to the control c) The custom control must be registered with windows first. d) The assembly from the custom control is not in the application?s bin directory.

1 Answers   Syntax Softtech,


How would you implement inheritance using VB.NET/C#?

3 Answers   Siebel Systems,


What is shadowing?

2 Answers   Syntax Softtech,


What is the maximum amount of memory any single process on windows can address?

0 Answers  


What is asp.net mvc5? : Asp.Net MVC

0 Answers  


Categories