PRB: Error When You Store a JScript Array in Application Scope in IIS 5.0 (255887)



The information in this article applies to:

  • Microsoft Active Server Pages

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.
<!--  TEST.ASP -->
<%@ Language=JScript%>
<%     
	var Arr = new Array(25);
	Application("test") = Arr;
	response.write ("Hello");

%>
				
You receive the above-mentioned error message.

REFERENCES

For additional information, click the article number below to view the article in the Microsoft Knowledge Base:

255769 ASP 0197 When Storing STA or Both-Model Objects in Application


Modification Type:MajorLast Reviewed:6/19/2001
Keywords:kbCodeSnippet kbDSupport kberrmsg kbprb KB255887