Products Technologies Demo Docs Blog Support Company

ASP.NET DocumentEditor Deployment: Setting the APIRoute

When deploying the ASP.NET DocumentEditor, it is important to define the resource path and the API route when deploying applications to virtual paths other than the root. This article shows how to define these paths.

ASP.NET DocumentEditor Deployment: Setting the APIRoute

The ASP.NET DocumentEditor NuGet package is adding static resources such as images, icons and JavaScript sources to an application that are required by the editor. In version 30.0, by default, these static files are expected in the TXTextControl.Web folder location in the root of your web application. Additionally, the Web API calls to theWebSocketHandler are expected to be handled in the root of the application.

When deploying the application to a server, the default settings will work out-of-the-box when the application runs on the application's root such as:

https://demos.textcontrol.com

But what if the application is deployed to this URL?

https://demos.textcontrol.com/version30

Information

The information and solution in this blog article is valid for both .NET Framework and ASP.NET Core web applications.

Debugging the Problem

When adding the editor to an ASP.NET view without additional settings, the code would look similar to this:

@using TXTextControl.Web.MVC

@Html.TXTextControl().TextControl().Render()

When deploying this application to a different path than the root, you will see many errors in the F12 developer tools console:

Deployment of Text Control

Let's have deeper look into the network traffic:

Deployment of Text Control

The application is deployed to the virtual directory WebApplication120, but Text Control is trying to find the resources on the root and received a 404 on the resources. And that is 100% accurate as we deployed into a different directory and the resources are not available on the root folder.

Static Resource Location

One solution would be now to deploy the static resources to the root folder (which would be a good idea to share these resources), but in real-world scenarios, you want them in the same application folder.

Read More

Learn more about how to set the static files path in ASP.NET Core applications.

ASP.NET DocumentEditor: Set Static Files Path

To define the static resource folder, the StaticFilesPath property can be used. In this sample, we set the relative path to the static resource folder in the WebApplication120 sub-folder:

@using TXTextControl.Web.MVC

@Html.TXTextControl().TextControl(settings => {
    settings.StaticFilesPath = "/WebApplication120/TXTextControl.Web";
}).Render()

Web API Endpoint Location

When loading the editor now, there are less errors, but it is still not loading:

Deployment of Text Control

The editor is trying to connect to the WebSocketHandler on the wrong endpoint. In order to solve this, the APIRoute property can be used:

@using TXTextControl.Web.MVC

@Html.TXTextControl().TextControl(settings => {
    settings.StaticFilesPath = "/WebApplication120/TXTextControl.Web";
    settings.APIRoute = "WebApplication120/api";
}).Render()

As a result, Text Control is now able to find the Web API path and the static resources:

Deployment of Text Control

Stay in the loop!

Subscribe to the newsletter to receive the latest updates.

ASP.NET

Integrate document processing into your applications to create documents such as PDFs and MS Word documents, including client-side document editing, viewing, and electronic signatures.

ASP.NET Core
Angular
Blazor
JavaScript
React
  • Angular
  • Blazor
  • React
  • JavaScript
  • ASP.NET MVC, ASP.NET Core, and WebForms

Learn more Trial token Download trial

Related Posts

ASP.NETJavaScriptDeployment

DS Server or TX Text Control? Different Deployment Scenarios

The Text Control document processing technology can be deployed in various ways using different products for different applications. This overview explains the differences and deployment strategies.


ASP.NETASP.NET CoreDS Server

Getting Started Video Tutorial: Using DS Server with Docker

This video tutorial demonstrates how to quickly set up a Docker container with your own on-premises DS Server backend. You'll learn how to spin up the container in just seconds and configure it to…


ASP.NETASP.NET CoreConference

Unleash Document Automation Superpowers at NDC Oslo 2025

Join us at NDC Oslo 2025 to discover how to supercharge your document automation with the latest features and best practices. At our booth, you can explore the latest advances in document…


ASP.NETASP.NET CoreDocker

Announcing the Official DS Server Docker Image on Docker Hub

The official DS Server Docker image is now available on Docker Hub. This makes it easier to deploy the DS server in a containerized environment and manage and scale your applications. Based on the…


ASP.NETASP.NET CoreDS Server

Introducing DS Server 4.0: Linux-Ready and Container-Friendly

We are excited to announce the release of DS Server 4.0, our latest major update that makes your document processing workflows more flexible and powerful. This release marks two significant…