Hello,
Hello Itay,
Thanks, that was an interesting read.
Hello Itay,
GroupDocs.Viewer for .NET requires cache in all cases, without exception. When you open the document, GroupDocs.Viewer converts it to the HTML-representation: set of HTML markup, images, CSS, fonts, SVG, JavaScript and so on. In order to deliver maximum performance on a client-side, GroupDocs.Viewer doesn’t transfer all converted document to the browser - it sends only first few pages and loads other parts of documents on demand, when you want to browse especially that pages. That’s why cache is absolutely necessary.
There are two ways how the cache may be used. By default, GroupDocs.Viewer creates a cache in the “/temp” subfolder. Another way is to use the “IStorageProvider” approach. The class “Groupdocs.Web.UI.Viewer” contains a static method “SetStorageProvider”, which has the next overload:
public static void SetStorageProvider(IStorageProvider storageProvider, IStorageProvider tempStorageProvider);
If you specify this method, GroupDocs.Viewer will not use any files in the local folder at all: all operations will be done via storage provider.
First parameter, “storageProvider”, is responsible for obtaining and browsing documents, which should or can be displayed.
Second parameter, “tempStorageProvider”, is responsible for internal files, including cache.
Of course, this approach requires additional coding - you should implement the “IStorageProvider” interface by yourself. But this approach is very flexible and allows you to specify any storage of any kind.
So, in the Global.asax or where you want to initialize the GroupDocs.Viewer, you should have something like this:
IStorageProvider document_storage = new YourCustomStorageProviderForDocuments();
IStorageProvider cache_storage = new YourCustomStorageProviderForCache();
Viewer.SetStorageProvider(document_storage, cache_storage);
Here is a special version of the “GroupDocs.Viewer Sample Demo”. Inside the solution there is a project “GroupDocsViewerMVCDemo”. This project is modified - it uses the “IStorageProvider” implementation of the custom storage provider.
So, concluding, cache should exist in any case. If your implementation of the “IStorageProvider” will be incorrect, undefined and non-obvious errors may occur. This way requires maximum attention.
Thanks for the details response.