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

Extending DS Server with Custom Digital Signature APIs

In this article, we will explore how to extend the functionality of DS Server by integrating custom digital signature APIs. We will cover the necessary steps to create a plugin that allows DS…


ASP.NETASP.NET CoreConference

Meet Text Control at DDC 2025 in Cologne

Join us at the .NET Developer Conference (DDC) 2025 in Cologne from November 24-27. Visit our booth to explore the latest in document generation and reporting with Text Control's DS Server and…


ASP.NETASP.NET CoreDS Server

Building an Ecosystem around DS Server: Join Us as a Plug-in Pioneer

DS Server 4.1.0 introduces a plug-in architecture that transforms the platform into an extensible ecosystem. Text Control invites developers, ISVs, and domain experts to co-innovate, build the…


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…