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 |
What are the action filters available in asp.net mvc
Types of object in asp ?
how we Creating a Web Service
ADO.Net - how to get data from database and bind to the controls -- write this small code
Can I recieve both html markup for page and code in the asp.net web page's source code portion in the web browser?
How we can set Different levels of Authentication in .Net? What are the difference between Windows Authenticatin, Passport Authentication and Form Authentication?
Differentiate between file-based dependency and key-based dependency.
How many types of validation controls are provided by ASP.NET?
How can we create Tree control in asp.net?
What is the difference between equals() and == in c#?
What is clr? Difference between clr & cts?
What is the concept of view state in asp.net?
Visual Basic (800)
C Sharp (3816)
ASP.NET (3180)
VB.NET (461)
COM+ (79)
ADO.NET (717)
IIS (369)
MTS (11)
Crystal Reports (81)
BizTalk (89)
Dot Net (2435)
Exchange Server (362)
SharePoint (720)
WCF (340)
MS Office Microsoft (6963)
LINQ Language-Integrated Query (317)
WPF (371)
TypeScript (144)
Microsoft Related AllOther (311)