DEXTUpload.NET Professional
menu toggleReferences > DEXTUpload.NET > DownloadOption

DEXTUpload.NET
Class DownloadOption

The minimum supported version
5.0.0.0
The minimum support environment
.NET Framework 4.0
Explanation

The "DownloadOption" class is used as a parameter that contains necessary settings when downloading a file by the "Download" method of the "DEXTUpload.NET.FileDownload".

using (var dext = new FileDownload())
{
    // Download the pdf file as an inline type.
    dext.Download("~/files/attach/target.pdf", new DownloadOption { 
        MimeType = "application/pdf", 
        IsInline = true
    });
}
Type
public class DownloadOption
Constructors

DownloadOption

  • Does initialization when creating an instance of the "DownloadOption" class.

  • Type

    public DownloadOption()
    public DownloadOption(bool isInline, string mime, bool allowWeakRange, bool useClientCache, bool removeAfterDownloading)
    public DownloadOption(bool isInline, string mime, bool allowWeakRange, bool useClientCache, bool removeAfterDownloading, TimeSpan maxAge)
  • Parameters

    Name Type Explanation
    isInline System.Boolean To download a file as an in-line type is "true".
    mime System.String The MIME type of the object to be downloaded
    allowWeakRange System.Boolean To allow Partial Content download using only the "Range" header is "true".
    useClientCache System.Boolean To use the response cache policy is "true".
    removeAfterDownloading System.Boolean After downloading, to remove the target file is "true".
    maxAge (Support from 5.4.0.0 version) System.TimeSpan the maximum age of request resource
Properties

IsInline

  • Gets or sets whether to download a file as an in-line type.

    The in-line, it means that you set the "Content-Disposition" response header of the response data(files or data you want to download) to "inline". When set to "inline", if the response data are interpretable by browser, it is opened directly from the browser or an associated function is performed with it.

    By default, is "false", "Content-Disposition" response header is "attachment".

  • Type

    public bool IsInline { get; set; }

MimeType

  • Gets or sets the MIME type of the file to be downloaded.

    Response sets the MIME type of the data in the "Content-Type" When downloading the file as an attachment, the MIME type does not largely affect to the browser behavior. but if the file is downloaded as an in-line, the browser must know about the MIME type of the data so that it can be recognized. Occasionally, some browser run to open the data regardless of the "Content-Type" response header. Usually modern browser process the data based on the "Content-Type" header.

    By default, it is "application/octet-stream".

  • Type

    public string MimeType { get; set; }

AllowingWeakRange

  • Gets or sets whether the Partial Content download by using only the "Range" header.

    The "AllowingWeakRange" is used when permitting the Partial Content download with only the "Range" header without the response header such as "ETag". Partial Content download is used only in the case of download of a file from disk not memory data.

    By default, it is "false".

  • Type

    public bool AllowingWeakRange { get; set; }

UseClientCache

  • Gets or sets whether to use the response cache policy.

    Response cache policy is that it sets such "ETag" header, the modified date of the file, cache expiration. Response cache policy is applied to the case of the download a file from disk not memory data.

    By default, it is "false".

  • Type

    public bool UseClientCache { get; set; }

RemoveAfterDownloading

  • Gets or sets whether or not to delete the target file after downloading.

    Instead of memory data, in the case of a file from disk, the download is complete, it is possible to remove the target.

    By default, it is "false".

  • Type

    public bool RemoveAfterDownloading { get; set; }

MaxAge (Support from 5.4.0.0 version)

  • Gets or sets the maximum age of the request resource.

    The default value is one day.

  • Type

    public TimeSpan MaxAge { get; set; }