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

Does google crawl redirects?

0 Answers  


How you will handle session when deploying application in more than a server? Describe session handling in a webfarm, how does it work and what are the limits?

3 Answers   CoreObjects,


How do I use a proxy server when invoking a web service?

0 Answers  


What is the difference between session and application?

0 Answers  


Can I recieve both html markup for page and code in the asp.net web page's source code portion in the web browser?

0 Answers  






Guys can anobody tell what is Conditional Bloating in asp.net ??

1 Answers  


I’m having some trouble with cas. How can I diagnose my problem?

0 Answers  


I have got less marks in bsc it So how to get interview.tell me

1 Answers  


What property is used on the datatable to indicate a conflict after an update? a) HasConflict b) HasError c) HasCollision d) HasDataError

1 Answers   Syntax Softtech,


How many classes can a single .NET DLL contain?

14 Answers   Siebel Systems,


Where is session cookies stored?

0 Answers  


Difference Between ReadOnly and Constant Variable in compile time and Run Time.

3 Answers   Phoenix Technologies, Quadrant,


Categories