Prerequisites
Before installing the OnlyOffice Control, ensure you have:- An ASP.NET Web Forms project targeting .NET Framework 4.8
- Access to an OnlyOffice Document Server instance
- The OnlyOffice Document Server API URL and JWT secret
Installation Steps
Copy the Controls Folder
Copy the entire
Controls/OnlyOfficeEditor folder to your ASP.NET Web Forms project root directory.Your project structure should look like this:Configure Web.config (Optional)
If you plan to upload large documents, configure the file upload limits in your
Web.config:Web.config
The
maxRequestLength is in kilobytes, while maxAllowedContentLength is in bytes.Create Uploads Directory
The control stores uploaded and edited documents in
~/App_Data/uploads. This directory is created automatically, but you can create it manually:Configure OnlyOffice Settings
Open
Controls/OnlyOfficeEditor/OnlyOfficeEditor.ascx.cs and update the configuration properties:OnlyOfficeEditor.ascx.cs
How to find these values
How to find these values
OnlyOfficeApiUrl: This is the URL to the OnlyOffice Document Server API JavaScript file. If your OnlyOffice server is at
https://docs.example.com, the API URL would be https://docs.example.com/web-apps/apps/api/documents/api.js.JwtSecret: This is the JWT secret configured in your OnlyOffice Document Server’s local.json configuration file under services.CoAuthoring.secret.session.string.PublicBaseUrl: This is the public-facing URL of your ASP.NET application. OnlyOffice Document Server must be able to reach this URL to download documents and send callbacks.Configuration Options
JWT Secret Management
For production environments, it’s recommended to store the JWT secret in a secure location rather than hardcoding it:Network Configuration
If your OnlyOffice Document Server uses self-signed SSL certificates, the control includes certificate validation bypass. For production, configure proper SSL certificates.
Namespace Configuration
The default namespace isOnlyOfficeControl.Controls.OnlyOfficeEditorBundle. If you need to change it:
- Update the namespace in all
.csfiles - Update the
Inheritsattribute in.ascxfiles - Rebuild the project
Troubleshooting
Control not appearing on page
Control not appearing on page
Verify the control is properly registered on your ASPX page:
OnlyOffice editor shows 'Cannot connect to server'
OnlyOffice editor shows 'Cannot connect to server'
This usually means:
- The
OnlyOfficeApiUrlis incorrect or unreachable - CORS is not properly configured on the OnlyOffice server
- The OnlyOffice server cannot reach your
DocumentUrl(firewall/network issue)
JWT token errors
JWT token errors
Ensure:
- The
JwtSecretmatches exactly with your OnlyOffice server configuration - JWT is enabled on the OnlyOffice Document Server
- The secret is not empty or whitespace
File upload errors
File upload errors
Check:
- Web.config has proper file size limits configured
- IIS application pool identity has write permissions to
App_Data - The
uploadsfolder exists and is writable
Callback not working
Callback not working
Verify:
- The
PublicBaseUrlis publicly accessible from the OnlyOffice server - The OnlyOffice server can reach your application (no firewall blocking)
- The
CallbackUrlis properly generated
Next Steps
Quick Start
Learn how to use the OnlyOffice Control in your application