Back to Devexpress

DefaultWebDocumentViewerContainer.UseFileExportedDocumentStorage(String, StorageSynchronizationMode) Method

xtrareports-devexpress-dot-xtrareports-dot-web-dot-webdocumentviewer-dot-defaultwebdocumentviewercontainer-dot-usefileexporteddocumentstorage-x28-string-storagesynchronizationmode-x29.md

latest6.8 KB
Original Source

DefaultWebDocumentViewerContainer.UseFileExportedDocumentStorage(String, StorageSynchronizationMode) Method

Specifies a path and synchronization mode for the exported document’s file storage.

Namespace : DevExpress.XtraReports.Web.WebDocumentViewer

Assembly : DevExpress.XtraReports.v25.2.Web.dll

NuGet Package : DevExpress.Web.Reporting.Common

Declaration

csharp
public static void UseFileExportedDocumentStorage(
    string workingDirectory,
    StorageSynchronizationMode storageSynchronizationMode
)
vb
Public Shared Sub UseFileExportedDocumentStorage(
    workingDirectory As String,
    storageSynchronizationMode As StorageSynchronizationMode
)

Parameters

NameTypeDescription
workingDirectoryString

Specifies a path to the directory where exported documents should be stored.

| | storageSynchronizationMode | StorageSynchronizationMode |

Specifies a synchronization mode for the file storage.

|

Remarks

The Document Viewer uses a cache or file storage to get the exported document in the following cases:

By default, the exported document is stored in a memory cache and removed from it the first time it is requested. You can make the Document Viewer use a file storage instead. For this purpose, use the UseFileExportedDocumentStorage method.

Use the UseFileExportedDocumentStorage(String, StorageSynchronizationMode) method overload to specify the InterProcess synchronization mode if you use Web Farms or Garden. By default, the InterThread mode is set.

The following code demonstrates how to use the UseFileExportedDocumentStorage method to specify a file storage for the Document Viewer.

csharp
using DevExpress.XtraReports.Web.WebDocumentViewer;
//... 
  DefaultWebDocumentViewerContainer.UseFileExportedDocumentStorage(Server.MapPath("~/App_Data/PreviewCache"), StorageSynchronizationMode.InterProcess);
//...
vb
Imports DevExpress.XtraReports.Web.WebDocumentViewer
'... 
  DefaultWebDocumentViewerContainer.UseFileExportedDocumentStorage(Server.MapPath("~/App_Data/PreviewCache"), StorageSynchronizationMode.InterProcess)
'...

The cleaner service periodically searches the cache and file storage for expired documents/exported documents/reports and deletes them. You can use the CacheCleanerSettings and StorageCleanerSettings to specify check interval and expiration time settings. To prevent expired documents from being deleted, call the UseEmptyStoragesCleaner() method to register an empty storage cleaner.

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the UseFileExportedDocumentStorage(String, StorageSynchronizationMode) method.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

reporting-web-mvc-viewer-clustering/CS/DevExpressWebFarmsWebGardenReporting/Global.asax.cs#L13

csharp
protected void Application_Start(object sender, EventArgs e) {
    DefaultWebDocumentViewerContainer.UseFileExportedDocumentStorage(Server.MapPath("~/CustomSharedViewerStorage/ExportedDocuments"), StorageSynchronizationMode.InterProcess);
    DefaultWebDocumentViewerContainer.UseFileDocumentStorage(Server.MapPath("~/CustomSharedViewerStorage/Documents"), StorageSynchronizationMode.InterProcess);

reporting-web-mvc-viewer-clustering/VB/DevExpressWebFarmsWebGardenReporting/Global.asax.vb#L14

vb
Protected Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
    DefaultWebDocumentViewerContainer.UseFileExportedDocumentStorage(Server.MapPath("~/CustomSharedViewerStorage/ExportedDocuments"), StorageSynchronizationMode.InterProcess)
    DefaultWebDocumentViewerContainer.UseFileDocumentStorage(Server.MapPath("~/CustomSharedViewerStorage/Documents"), StorageSynchronizationMode.InterProcess)

See Also

UseFileDocumentStorage

UseFileReportStorage

DefaultWebDocumentViewerContainer Class

DefaultWebDocumentViewerContainer Members

DevExpress.XtraReports.Web.WebDocumentViewer Namespace