FtpWebRequest.DefaultCachePolicy Property
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Defines the default cache policy for all FTP requests.
public:
static property System::Net::Cache::RequestCachePolicy ^ DefaultCachePolicy { System::Net::Cache::RequestCachePolicy ^ get(); void set(System::Net::Cache::RequestCachePolicy ^ value); };
public static System.Net.Cache.RequestCachePolicy? DefaultCachePolicy { get; set; }
public static System.Net.Cache.RequestCachePolicy DefaultCachePolicy { get; set; }
static member DefaultCachePolicy : System.Net.Cache.RequestCachePolicy with get, set
Public Shared Property DefaultCachePolicy As RequestCachePolicy
A RequestCachePolicy that defines the cache policy for FTP requests.
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 |
---|---|
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. |
Note
Setting DefaultCachePolicy overrides any configuration setting.
Product | Versions |
---|---|
.NET | Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9 |
.NET Framework | 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET Standard | 2.0, 2.1 |
.NET feedback
.NET is an open source project. Select a link to provide feedback: