FtpWebRequest::DefaultCachePolicy Property
Defines the default cache policy for all FTP requests.
Assembly: System (in System.dll)
public: property RequestCachePolicy^ DefaultCachePolicy { static RequestCachePolicy^ get(); static void set(RequestCachePolicy^ value); }
Property Value
Type: System.Net.Cache::RequestCachePolicy^A System.Net.Cache::RequestCachePolicy that defines the cache policy for FTP requests.
| Exception | Condition |
|---|---|
| ArgumentNullException | The caller tried to set this property to null. |
Only content received using the DownloadFile command is cached.
The following table describes the effects of FTP caching policies on FtpWebRequest.
Policy | Effect |
|---|---|
Returns the cached resource if the resource is fresh, the content length is accurate, and the expiration, modification, and content length attributes are present. | |
Returns the resource from the server. | |
Returns the cached resource if the content length is present and matches the entry size; otherwise, throws a WebException. | |
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. | |
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. | |
Downloads the resource from the server, stores it in the cache, and returns the resource to the caller. | |
If a cached resource exists, it is deleted. The resource is downloaded from the server and is returned to the caller. |
Note |
|---|
Setting DefaultCachePolicy overrides any configuration setting. |
Available since 2.0
