What does AspCompat="true" mean and when should I use it?
Answer Posted / 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 View All Answers
i want to implement grid view value in paypal site. so how to create this code in asp.net with C#
How Can assign alias name for ASP.NET Web API Action?
If iam developing an application that must accomodate multiple security levels though secure login and my asp.net web appplication is spanned across three web-servers (using round-robbin load balancing) what would be the best approach to maintain login-in state for the users?
What are the two Layouts supported by a Web form in ASP.NET?
What is a 1x1 pixel?
Do session use cookies in asp net?
Explain the procedure to handle the process request using mhpm events fired? : asp.net mvc
How could you modify xaml content from javascript?
What are the authentication types in asp.net?
Which method has beenintroduced in asp.net 4.0 to redirect a page permanently?
What is comparevalidator?
Explain the flow of processing of the request? : asp.net mvc
How can you implement encapsulation in asp.net?
Explain Authentication mechanism in dotnet
How do you change the session time-out value?