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.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.


ASP.NETASP.NET CoreDocument Editor

ASP.NET Core Document Editor with Backend via the Text Control Private NuGet…

This article demonstrates how to create a Document Editor ASP.NET Core application using the Text Control Private NuGet Feed. We will build a basic web application that enables users to edit…


ASP.NETASP.NET CoreDocument Automation

Why Document Processing Libraries Require a Document Editor

A document processing library alone cannot guarantee reliable and predictable results. Users need a true WYSIWYG document editor to design and adjust templates to appear exactly as they will after…


ASP.NETWindows FormsWPF

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

TX Text Control 34.0 Service Pack 1 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…

Share on this blog post on: