Expand
AspNetCacheProfileAttribute Class
.NET Framework 4

When applied to a service operation, indicates the ASP.NET output cache profile in the configuration file that should be used by to cache responses from the operation in the ASP .NET Output Cache.

Namespace:  System.ServiceModel.Web
Assembly:  System.ServiceModel.Web (in System.ServiceModel.Web.dll)
Syntax

'Declaration

<AttributeUsageAttribute(AttributeTargets.Method)> _
Public NotInheritable Class AspNetCacheProfileAttribute _
	Inherits Attribute _
	Implements IOperationBehavior
Remarks

For more information about the kinds of setting you can make with the Output Cache Profile, see ASP.NET Cache Settings.

Examples

The following example shows how to apply the AspNetCacheProfileAttribute attribute to a service operation. In this case, the cache profile named “CacheFor60Seconds” will be used for the GetCustomer operation

The following configuration snippet shows how the “CacheFor60Seconds” cache profile is specified.

<configuration>
    <system.web>
      <compilation debug="true" targetFramework="4.0" />
      <caching>
        <outputCacheSettings>
          <outputCacheProfiles>
            <add name="CacheFor60Seconds" duration="60" varyByParam="format" varyByHeader="Accept" />
          </outputCacheProfiles>
        </outputCacheSettings>
      </caching>
    </system.web>
</configuration>


Inheritance Hierarchy

System.Object
  System.Attribute
    System.ServiceModel.Web.AspNetCacheProfileAttribute
Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Platforms

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role not supported), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Version Information

.NET Framework

Supported in: 4
Community ContentAdd
Page view tracker