Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

FtpWebRequest.DefaultCachePolicy Property

Note: This property is new in the .NET Framework version 2.0.

Defines the default cache policy for all FTP requests.

Namespace: System.Net
Assembly: System (in system.dll)

public static RequestCachePolicy DefaultCachePolicy { get; set; }
/** @property */
public static RequestCachePolicy get_DefaultCachePolicy ()

/** @property */
public static void set_DefaultCachePolicy (RequestCachePolicy value)

public static function get DefaultCachePolicy () : RequestCachePolicy

public static function set DefaultCachePolicy (value : RequestCachePolicy)

Property Value

A System.Net.Cache.RequestCachePolicy that defines the cache policy for FTP requests.
Exception typeCondition

ArgumentNullException

The caller tried to set this property to a null reference (Nothing in Visual Basic).

Only content received using the DownloadFile command is cached.

The following table describes the effects of FTP caching policies on FtpWebRequest.

Policy

Effect

Default

Returns the cached resource if the resource is fresh, the content length is accurate, and the expiration, modification, and content length attributes are present.

BypassCache

Returns the resource from the server.

CacheOnly

Returns the cached resource if the content length is present and matches the entry size; otherwise, throws a WebException.

CacheIfAvailable

Returns the cached resource if the content length is provided and matches the entry size; otherwise, the resource is downloaded from the server and is returned to the caller.

Revalidate

Returns the cached resource if the timestamp of the cached resource is the same as the time stamp of the resource on the server; otherwise, the resource is downloaded from the server, stored in the cache, and returned to the caller.

Reload

Downloads the resource from the server, stores it in the cache, and returns the resource to the caller.

NoCacheNoStore

If a cached resource exists, it is deleted. The resource is downloaded from the server and is returned to the caller.

NoteNote

Setting DefaultCachePolicy overrides any configuration setting.

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

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

.NET Framework

Supported in: 2.0
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.