Products Technologies Demo Docs Blog Support Company

ASP.NET DocumentEditor: Set Static Files Path

In recent versions, the static files path had to be defined for all routes in where the editor is used. A new property has been introduced to define the static files path once for all routes.

ASP.NET DocumentEditor: Set Static Files Path

In recent versions, the static files path had to be defined for all routes in where the editor is used. In version 30.0, a new property has been introduced to define the static files path once for all routes. Previously, each path, where the editor was used, had to be defined individually in the Startup.cs like this:

// serve static linked files (JavaScript and CSS for the editor)
app.UseStaticFiles(new StaticFileOptions {
  FileProvider = new Microsoft.Extensions.FileProviders.PhysicalFileProvider(
     System.IO.Path.Combine(System.IO.Path.GetDirectoryName(
        System.Reflection.Assembly.GetEntryAssembly().Location),
        "TXTextControl.Web")),
  RequestPath = "/envelope/create/TXTextControl.Web"
});

app.UseStaticFiles(new StaticFileOptions {
  FileProvider = new Microsoft.Extensions.FileProviders.PhysicalFileProvider(
     System.IO.Path.Combine(System.IO.Path.GetDirectoryName(
        System.Reflection.Assembly.GetEntryAssembly().Location),
        "TXTextControl.Web")),
  RequestPath = "/collaboration/edit/TXTextControl.Web"
});

In the above sample, the static files can be found from the following routes:

  • .../envelope/create/
  • .../collaboration/edit/

In version 30.0, by default, the static files are expected in the TXTextControl.Web folder location in the root of your web application.

For the above sample, only the following code is required in the Startup.cs:

app.UseStaticFiles(new StaticFileOptions
{
  FileProvider = new Microsoft.Extensions.FileProviders.PhysicalFileProvider(
     System.IO.Path.Combine(System.IO.Path.GetDirectoryName(
        System.Reflection.Assembly.GetEntryAssembly().Location),
        "TXTextControl.Web")),
  RequestPath = "/TXTextControl.Web"
});

If the editor is used in any path in the application in a view, the static files are now found automatically:

@Html.TXTextControl().TextControl(settings => {
   settings.Dock = TXTextControl.Web.DockStyle.Fill;
}).Render()

The virtual folder location and name of the static files can be changed in the Startup.cs (TXTextControl.Web.MyName in this case):

app.UseStaticFiles(new StaticFileOptions
{
  FileProvider = new Microsoft.Extensions.FileProviders.PhysicalFileProvider(
     System.IO.Path.Combine(System.IO.Path.GetDirectoryName(
        System.Reflection.Assembly.GetEntryAssembly().Location),
        "TXTextControl.Web")),
  RequestPath = "/TXTextControl.Web.MyName"
});

Then, this path can be defined in the view using the StaticFilesPath property:

@Html.TXTextControl().TextControl(settings => {
   settings.Dock = TXTextControl.Web.DockStyle.Fill;
   settings.StaticFilesPath = "/TXTextControl.Web.MyName";
}).Render()

Learn more about the other new features, improvements and changes of TX Text Control 30.0:

What's New in Version 30.0?

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.NETASP.NET CoreDocument Editor

5 Layout Patterns for Integrating the TX Text Control Document Editor in…

When integrating a document editor into an ASP.NET Core application, the technical setup is only one part of the work. Just as important is the question of how the editor fits into the user…


ASP.NETAIASP.NET Core

Introducing Text Control Agent Skills

Text Control Agent Skills are structured definitions that teach AI coding assistants how to build applications with the TX Text Control Document Editor. Each skill contains step-by-step…


ASP.NETApp ServicesASP.NET Core

Deploying the TX Text Control Document Editor from the Private NuGet Feed to…

This tutorial shows how to deploy the TX Text Control Document Editor to Azure App Services using an ASP.NET Core Web App. The Document Editor is a powerful word processing component that can be…


ASP.NETWindows FormsWPF

TX Text Control 34.0 SP2 is Now Available: What's New in the Latest Version

TX Text Control 34.0 Service Pack 2 is now available, offering important updates and bug fixes for all platforms. If you use TX Text Control in your document processing applications, this service…


ASP.NETJavaScriptASP.NET Core

Build a Custom Backstage View in ASP.NET Core with TX Text Control

This article shows how to build a custom backstage view with a File tab to load your multi-format documents using TX Text Control for ASP.NET Core applications.

Share on this blog post on: