The ASP.NET MVC DocumentViewer can be used to view all document types that are supported by TX Text Control including TX, DOC, DOCX, RTF and PDF.
When loading documents using the JavaScript load ╰ TX Text Control .NET Server for ASP.NET
╰ JavaScript API - Document Viewer Viewer
╰ TXDocumentViewer Object
╰ loadDocument Method
Loads a document from memory into the DocumentViewer. method or when loading from memory directly in the MVC view code, the document will be sent to the server in a POST request. For larger documents, it is required to increase the size of data that can be send to the server.
There are 3 areas in the web.config file that have to be adjusted to accept larger POST requests:
- IIS Request Filtering
- HttpRuntime maxRequestLength
- MaxJsonDeserializerMembers
IIS Request Filtering
On IIS level, the Request Filtering module is used to limit the size of data accepted by IIS. Increase the maxAllowedContentLength value that specifies the size of the POST buffer given in bytes.
The default size is 30000000 bytes (28.6 MB). Max value is 4294967295 bytes (4 GB)
<?xml version="1.0" encoding="UTF-8"?> | |
<configuration> | |
<system.webServer> | |
<security> | |
<requestFiltering> | |
<requestLimits maxAllowedContentLength="4294967295" /> | |
</requestFiltering> | |
</security> | |
</system.webServer> | |
</configuration> |
HttpRuntime maxRequestLength
ASP.NET has its own setting to limit the size of uploads and requests. Use the maxRequestLength of the httpRuntime element.
The default size is 4096 kilobytes (4 MB). Max value 2,147,483,647 kilobytes (~82 Terabyte). The following setting defines a max size of 500 megabytes.
<?xml version="1.0" encoding="UTF-8"?> | |
<configuration> | |
<system.web> | |
<httpRuntime maxRequestLength="500000" executionTimeout="120" /> | |
</system.web> | |
</configuration> |
Pay attention to the different units used by these settings. Request Filtering is in bytes and HttpRuntime maxRequestLength is given in kilobytes.
MaxJsonDeserializerMembers
All data is send as JSON objects in the DocumentViewer client-server communication. The number of properties in a posted JSON object needs to be adjusted using the aspnet:MaxJsonDeserializerMembers application setting:
<configuration> | |
<appSettings> | |
<add key="aspnet:MaxJsonDeserializerMembers" value="10000" /> | |
</appSettings> | |
</configuration> |
By adjusting the above settings in your web.config, all document sizes can be loaded from memory.