Microsoft KB Archive/255887

= PRB: Error When You Store a JScript Array in Application Scope in IIS 5.0 =

Article ID: 255887

Article Last Modified on 6/19/2001

-

APPLIES TO


 * Microsoft Active Server Pages 4.0

-



This article was previously published under Q255887



SYMPTOMS
If you store a JScript array object in Active Server Pages (ASP) application scope using Server.CreateObject but not using "Object tag", you receive the following error message:

Application object, ASP 0197 (0x80004005)

Disallowed object use

Cannot add object with apartment model behavior to the application intrinsic object.



CAUSE
JScript arrays are considered to be "Apartment" COM components. Only Component Object Model (COM) components that aggregate the Free Threaded Marshaler (FTM) can be assigned to Application scope within an Internet Information Server (IIS) 5.0 ASP page. Because an "Apartment" component cannot aggregate the FTM (it cannot allow a direct pointer to be passed to its clients, unlike a "Both with FTM" object), JScript arrays do not aggregate the FTM. Therefore, JScript arrays cannot be assigned to Application scope from an ASP page.



MORE INFORMATION
To reproduce this behavior, copy the following code to Microsoft Notepad, save it as Test.asp, and then test it. <%@ Language=JScript%> <%        var Arr = new Array(25); Application("test") = Arr; response.write ("Hello");

%> You receive the above-mentioned error message.

