Microsoft KB Archive/917411

= The System.Web.Caching.Cache object is not intended for use outside ASP.NET in the .NET Framework 1.1 and in the .NET Framework 1.0 =

Article ID: 917411

Article Last Modified on 12/3/2007

-

APPLIES TO


 * Microsoft .NET Framework 1.0
 * Microsoft .NET Framework 1.0 Service Pack 1
 * Microsoft .NET Framework 1.0 Service Pack 2
 * Microsoft .NET Framework 1.0 Service Pack 3
 * Microsoft .NET Framework 1.1
 * Microsoft .NET Framework 1.1 Service Pack 1

-





INTRODUCTION
The System.Web.Caching.Cache object in the Microsoft .NET Framework 1.1 and in the Microsoft .NET Framework 1.0 is not intended for use outside Microsoft ASP.NET. The Cache object was designed and tested for use by ASP.NET to provide ASP.NET caching. If you try to use Cache objects in other types of applications, such as console applications or Windows Forms applications, the Cache objects may not work correctly.

Note The specific problem that is described in the &quot;More Information&quot; section does not occur in the Microsoft .NET Framework 2.0. Therefore, you can use the Cache object outside ASP.NET in the .NET Framework 2.0. However, we recommend that you consider using the Caching Application Block because it offers you more options for customization to meet application requirements.



MORE INFORMATION
You cannot create a System.Web.Caching.Cache object on an operating system that does not have ASP.NET installed. Cache object cleanup is provided by the ASP.NET infrastructure, and expired or unused Cache objects cannot be automatically removed if the application is not an ASP.NET application. Therefore, if Cache objects are used outside ASP.NET, the system memory that is reserved for the Cache objects is not released. You cannot manually invoke the internal ASP.NET methods to clean up the cache because the methods are marked as internal and intended for internal use.

The .NET Framework 1.1 does not contain a general-purpose object to provide cache support outside ASP.NET. However, the Microsoft Patterns and Practices series of application blocks includes a Caching Application Block that is designed to be reused in many different types of applications.

