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.

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 Static
@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:
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.
- Angular
- Blazor
- React
- JavaScript
- ASP.NET MVC, ASP.NET Core, and WebForms
Related Posts
TX Text Control 33.0 SP3 is Now Available: What's New in the Latest Version
TX Text Control 33.0 Service Pack 3 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.NETASP.NET CoreDocument Viewer
High-Performance Text Replacement in Large DOCX Files using C# .NET
Learn how to efficiently replace text in large DOCX files using C# .NET and the ServerTextControl component from Text Control. This article demonstrates the performance benefits of using the…
ASP.NETASP.NET CoreDocument Viewer
Document Viewer 33.2.1 Released: New Event and Bug Fixes
This service pack includes important bug fixes and improvements to enhance the stability and performance of the Document Viewer. In addition, a new event has been introduced to provide developers…
ASP.NETASP.NET CoreDocument Editor
Getting Started Video Tutorial: Document Editor in ASP.NET Core C# on Linux
This video tutorial shows how to use the Document Editor in an ASP.NET Core application using C# and deploy on Linux using Docker. This tutorial is part of the TX Text Control Getting Started…
ASP.NETAccessibilityASP.NET Core
Upcoming Support for PDF/UA Compliance and Tagged PDF Generation in Version 34.0
We are happy to announce that version 34.0 will support PDF/UA compliance and the creation of tagged PDF documents. This significant update demonstrates our ongoing commitment to accessibility by…