Adding Static Files
Adding TX Text Control to an ASP.NET Core Razor Pages application is the same like for MVC applications. If you create a new ASP.NET Core Web Application based on our tutorial, the following configuration code is added to the Startup.cs:
In the above code, the TXTextControl.Web directory hierarchy is publicly available in the TXTextControl.Web URI segment. The request to http://<server_address>/TXTextControl.Web/JS/tx-min.js serves the tx-min.js file.
This concept works very well for MVC applications where a controller is routing the requests to the views and the above static file requests are always routed to the root folder.
With Razor Pages, by convention, associations of URL paths to pages are determined by the page's location in the file system. This tutorial shows how to create a simple ASP.NET Core Razor Pages application. The content of the various segments is stored in folders named after the pages. The following screenshot shows this structure with folders for the available pages TestPage, TestPage2 and TestPage3:
Now, the resource request for the static files for TestPage is:
In order to solve this routing, another entry in the Startup.cs is required:
Pay attention to the RequestPath property that contains the page name as the first segment. Repeat this for all pages where TX Text Control is used to get the resources loaded properly.