FileDataDownloader Class
Used by the File Attachments module to send files to the client in ASP.NET Web Forms XAF Applications.
Namespace: DevExpress.ExpressApp.FileAttachments.Web
Assembly: DevExpress.ExpressApp.FileAttachment.Web.v24.2.dll
NuGet Package: DevExpress.ExpressApp.FileAttachment.Web
Declaration
Remarks
The FileDataDownloader class is used by the File Attachments module to send files to the client in ASP.NET Web Forms XAF Applications. To execute custom code when a file is downloaded, inherit the FileDataDownloader class and override the FileDataDownloader.DownloadCore method.
public class MyDownloader : FileDataDownloader {
public override void DownloadCore(DevExpress.Persistent.Base.IFileData fileData) {
// Place your code here.
base.DownloadCore(fileData);
}
}
Note
The DownloadCore method writes the file to the response and ends the response. So, place your custom code before the base.DownloadCore method call.
To register your FileDataDownloader descendant, call the static FileDataDownloader.SetDownloader method in the Application_Start method located in the Global.asax.cs (Global.asax.vb) file:
using DevExpress.ExpressApp.FileAttachments.Web;
//...
protected void Application_Start(object sender, EventArgs e) {
FileDataDownloader.SetDownloader(new MyDownloader());
//...
}