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"
});
view raw startup.cs hosted with ❤ by GitHub

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"
});
view raw startup.cs hosted with ❤ by GitHub

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()
view raw test.cshtml hosted with ❤ by GitHub

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"
});
view raw startup.cs hosted with ❤ by GitHub

Then, this path can be defined in the view using the StaticFilesPath TX Text Control .NET Server for ASP.NET
Web.MVC Namespace
TextControlSettings Class
StaticFilesPath Property
Specifies or returns the path for static files.
property:

@Html.TXTextControl().TextControl(settings => {
settings.Dock = TXTextControl.Web.DockStyle.Fill;
settings.StaticFilesPath = "/TXTextControl.Web.MyName";
}).Render()
view raw test.cshtml hosted with ❤ by GitHub

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

What's New in Version 30.0?