DEXTUpload.NET Professional
menu toggleReferences > DEXTUpload.NET > FileDownload

DEXTUpload.NET
Class FileDownload

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

The "FileDownload" class supports the response of the file format from the client's request.

"FileDownload" class, so as to be able to download a file in HTTP environment, has the ability to record a file data to response. This class provides the ability to download physical a file or download stream data that exists in the memory as a file format. If you downloaded the physical file using the "FileDownload" object, the header "ETag" header is automatically set to allow processing of the request header such as "If-None-Match, If-Range". And, when you use the" AllowingWeakRange" property of the "DEXTUpload.NET.DownloadOption" class, it is also possible to perform the Partial Content Download with only "Range" header without checking the Entity Tag value. (The Partial Content download is intended to return specified part of the data in the file as the response data.)

using (var dext = new FileDownload())
{
    dext.Download(new FileInfo("The path of the target file to download"));
}

If you want to download with calling the "Download" method, you must not write some additional data to the response object in the code. The "Download" method can be called only once.

Type
public class FileDownload : BaseComponent, IDisposable
Constructors

FileDownload

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

  • Type

    public FileDownload()
    public FileDownload(HttpContext context)
    
  • Parameters

    Name Type Explanation
    context System.Web.HttpContext An object that contains the information related to the HTTP request.
Properties

IsDisposed

  • Gets whether the resources managed by the object was released.

    If the value of this property is "true", it means that the "FileDownload" object is in a state that can not be used anymore.

  • Type

    public bool IsDisposed { get; }
Methods

Close

  • Releases the resources used by the object.

    It performs the same function as the "Dispose" method.

  • Type

    public void Close()

Dispose

  • Releases the resources used by the object.

  • Type

    public void Dispose()
    protected virtual void Dispose(bool explicitDisposing)
  • Parameters

    Name Type Explanation
    explicitDisposing System.Boolean "True" if the resource is explicitly released; otherwise, "false".

Download

  • Downloads a physical file or stream data on the memory.
  • Type

    public void Download(string filePath)
    public void Download(string filePath, DownloadOption option)
    public void Download(string filePath, string fileName)
    public void Download(string filePath, string fileName, DownloadOption option)
    public void Download(FileInfo file)
    public void Download(FileInfo file, DownloadOption option)
    public void Download(FileInfo file, string fileName)
    public void Download(FileInfo file, string fileName, DownloadOption option)
    public void Download(Stream stream, string fileName)
    public void Download(Stream stream, string fileName, DownloadOption option)
    
  • Parameters

    Name Type Explanation
    filePath System.String It is a path(virtual path of Web applications or physical path on the local operating system) of the file to be downloaded.
    fileName System.String Specifies the file name recognized by the client.
    option DEXTUpload.NET.DownloadOption An object with the information about the file to be downloaded.
    file System.IO.FileInfo An object that represents the path of the file to be downloaded.
    stream System.IO.Stream An object that it is possible to obtain the data to be downloaded.