Export (0) Print
Expand All

FtpWebRequest::DefaultCachePolicy Property

Defines the default cache policy for all FTP requests.

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

public:
static property RequestCachePolicy^ DefaultCachePolicy {
	RequestCachePolicy^ get ();
	void set (RequestCachePolicy^ value);
}

Property Value

Type: System.Net.Cache::RequestCachePolicy
A System.Net.Cache::RequestCachePolicy that defines the cache policy for FTP requests.

ExceptionCondition
ArgumentNullException

The caller tried to set this property to nullptr.

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.

.NET Framework

Supported in: 4.5.2, 4.5.1, 4.5, 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

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

Show:
© 2014 Microsoft