# Creating an ASP.NET MVC Application With Razor

> This tutorial covers integrating TX Text Control .NET Server for ASP.NET into an ASP.NET MVC application. It walks through installing the TXTextControl.Web NuGet package, creating an MVC 5 controller and a Razor view page, and rendering the HTML5 editor using HtmlHelper code.

- **Author:** Bjoern Meyer
- **Published:** 2020-01-01
- **Modified:** 2026-03-05
- **Description:** This tutorial covers integrating TX Text Control .NET Server for ASP.NET into an ASP.NET MVC application. It walks through installing the TXTextControl.Web NuGet package, creating an MVC 5 controller and a Razor view page, and rendering the HTML5 editor using HtmlHelper code.
- **3 min read** (525 words)
- **Tags:**
  - ASP.NET
  - HTML5
  - Razor
  - Tutorial
- **Web URL:** https://www.textcontrol.com/blog/2020/01/01/creating-an-aspnet-mvc-application-with-razor/
- **LLMs URL:** https://www.textcontrol.com/blog/2020/01/01/creating-an-aspnet-mvc-application-with-razor/llms.txt
- **LLMs-Full URL:** https://www.textcontrol.com/blog/2020/01/01/creating-an-aspnet-mvc-application-with-razor/llms-full.txt

---

Create Your Application
-----------------------

1. Make sure that you installed at least a trial version of TX Text Control .NET Server on your development machine:
    
    [Download Trial ](https://www.textcontrol.com/product/tx-text-control-dotnet-server/download/ "Download trial version")
2. Open Visual Studio and create a new *ASP.NET Web Application*. Make sure to select at least *.NET Framework 4.5* as the .NET Framework project version.
    
    ![image](https://s1-www.textcontrol.com/assets/dist/blog/2020/01/01/i/assets/mvc_step1.webp "image")
3. In the next dialog *New ASP.NET Project*, select *Empty* as your project template. Check the checkboxes *MVC* and *Web API* to add the folders and core references. Close the dialog with *OK*.
    
    ![image](https://s1-www.textcontrol.com/assets/dist/blog/2020/01/01/i/assets/mvc_step2.webp "image")
4. Click *Manage NuGet Packages...* from the *Project* main menu. Select *nuget.org* from the *Online* package source panel. In the upper right corner, search for *TXTextControl.Web*. Find the latest version and click on *Install*.
    
    ![image](https://s1-www.textcontrol.com/assets/dist/blog/2020/01/01/i/assets/mvc_step3.webp "image")
    
    Make sure to update the *Microsoft ASP.NET MVC* packages, if they are available in the *Updates* panel. Close the dialog with *Close*.
5. In the *Solution Explorer*, select *App\_Data* and choose *New Folder* from the *Project* main menu and name the folder *Documents*. Select the newly created folder *Documents* and click *Add Existing Item...* from the *Project* main menu.
    
    Browse to the following TX Text Control installation folder:
    
    *C:\\Program Files\\Text Control GmbH\\TX Text Control 28.0.NET Server for ASP.NET\\Samples\\Demo\\*
    
    Select the two files *invoice.docx* and *sample\_db.xml* and confirm with *Add*.
    
    ![image](https://s1-www.textcontrol.com/assets/dist/blog/2020/01/01/i/assets/mvc_step4.webp "image")
6. In the *Solution Explorer*, select the *Controllers* folder and choose *Add New Item...* from the *Project* main menu. In the opened dialog *Add New Item*, select *MVC 5 Controller - Empty* and confirm with *Add*. Set the name to *HomeController* and insert it by clicking the *Add* button.
    
    ![image](https://s1-www.textcontrol.com/assets/dist/blog/2020/01/01/i/assets/mvc_step5.webp "image")
7. In the *Solution Explorer*, select the newly created folder *Home* and choose *Add New Item...* from the *Project* main menu. Select *MVC 5 View Page (Razor)*, name it *Index* and confirm with *Add*.
    
    ![image](https://s1-www.textcontrol.com/assets/dist/blog/2020/01/01/i/assets/mvc_step6.webp "image")
8. Open the *Index.cshtml* view from the *Views -> Home* folder. Add the following Razor code to the top of the view:
    
    ```
    @using TXTextControl.Web
    @using TXTextControl.Web.MVC
    ```
9. Add the following HtmlHelper code to the end of the view page:
    
    ```
    @Html.TXTextControl().TextControl(settings => {
        settings.DocumentFileDirectory = Server.MapPath("~/App_Data/Documents");
    }).LoadXMLDatabase(
        Server.MapPath("~/App_Data/Documents/sample_db.xml")).LoadText(
        Server.MapPath("~/App_Data/Documents/invoice.docx"),
            StreamType.WordprocessingML).Render()
    ```
    
    The complete *Index.cshtml* should now look like this:
    
    ```
    @using TXTextControl.Web
    @using TXTextControl.Web.MVC
    
    @{
        ViewBag.Title = "Index";
    }
    
    <h2>Index</h2>
    
    @Html.TXTextControl().TextControl(settings =>
    {
        settings.DocumentFileDirectory = Server.MapPath("~/App_Data/Documents");
    }).LoadXMLDatabase(
        Server.MapPath("~/App_Data/Documents/sample_db.xml")).LoadText(
        Server.MapPath("~/App_Data/Documents/invoice.docx"),
            StreamType.WordprocessingML).Render()
    ```
10. Compile and start the application.

---

## About Bjoern Meyer

As CEO, Bjoern is the visionary behind our strategic direction and business development, bridging the gap between our customers and engineering teams. His deep passion for coding and web technologies drives the creation of innovative products. If you're at a tech conference, be sure to stop by our booth - you'll most likely meet Bjoern in person. With an advanced graduate degree (Dipl. Inf.) in Computer Science, specializing in AI, from the University of Bremen, Bjoern brings significant expertise to his role. In his spare time, Bjoern enjoys running, paragliding, mountain biking, and playing the piano.

- [LinkedIn](https://www.linkedin.com/in/bjoernmeyer/)
- [X](https://x.com/txbjoern)
- [GitHub](https://github.com/bjoerntx)

---

## Related Posts

- [Creating an ASP.NET MVC DocumentViewer Application With Razor](https://www.textcontrol.com/blog/2020/01/01/creating-an-aspnet-mvc-documentviewer-application-with-razor/llms.txt)
- [Creating Your First ASP.NET Reporting Application](https://www.textcontrol.com/blog/2020/01/01/creating-your-first-aspnet-reporting-application/llms.txt)
- [Creating an ASP.NET Web Forms AJAX Application](https://www.textcontrol.com/blog/2020/01/01/creating-an-aspnet-web-forms-ajax-application/llms.txt)
- [TextControl.Web: Creating an MVC Application with Razor](https://www.textcontrol.com/blog/2015/05/12/textcontrolweb-creating-an-mvc-application-with-razor/llms.txt)
- [ASP.NET Core: Use the Document Editor and Viewer in the Same Razor View](https://www.textcontrol.com/blog/2024/11/08/asp-net-core-use-the-document-editor-and-viewer-in-the-same-razor-view/llms.txt)
- [How to Mail Merge MS Word DOCX Documents in ASP.NET Core C#](https://www.textcontrol.com/blog/2023/10/16/how-to-mail-merge-ms-word-docx-documents-in-aspnet-core-csharp/llms.txt)
- [Adding SVG Watermarks to Documents](https://www.textcontrol.com/blog/2022/01/28/adding-svg-watermarks-to-documents/llms.txt)
- [Using MailMerge in ASP.NET Core 6 Web Applications](https://www.textcontrol.com/blog/2022/01/27/using-mailmerge-in-aspnet-core-6-web-applications/llms.txt)
- [Detect Toggle Button Changes Using a MutationObserver](https://www.textcontrol.com/blog/2021/11/11/detect-toggle-button-changes-using-a-mutationobserver/llms.txt)
- [Implementing Conditional Table Cell Colors with MailMerge](https://www.textcontrol.com/blog/2020/10/08/implementing-conditional-table-cell-colors-with-mailmerge/llms.txt)
- [New DocumentViewer Signature Tutorial Sample](https://www.textcontrol.com/blog/2020/08/18/new-documentviewer-signature-tutorial-sample/llms.txt)
- [Securing the WebSocketHandler Endpoint in ASP.NET](https://www.textcontrol.com/blog/2020/05/28/securing-the-websockethandler-endpoint-in-aspnet/llms.txt)
- [Integrate Document Editing into any HTML Client using the HTML Widget](https://www.textcontrol.com/blog/2020/01/01/integrate-document-editing/llms.txt)
- [Creating a WebSocket Server Project with Node.js](https://www.textcontrol.com/blog/2020/01/01/creating-a-websocket-server-project-with-nodejs/llms.txt)
- [Creating an Angular Document Editor Application](https://www.textcontrol.com/blog/2020/01/01/creating-an-angular-document-editor-application/llms.txt)
- [Automatically Reconnect to the Server and Recover the Document](https://www.textcontrol.com/blog/2019/09/05/automatically-reconnect-to-the-server-and-recover-the-document/llms.txt)
- [ReportingCloud .NET Core Quickstart Tutorial](https://www.textcontrol.com/blog/2019/07/24/reportingcloud-dotnet-core-quickstart-tutorial/llms.txt)
- [New Online Sample: Build your First Report](https://www.textcontrol.com/blog/2019/07/03/build-your-first-report/llms.txt)
- [Deploying the MVC HTML5 Editor to Azure App Services](https://www.textcontrol.com/blog/2018/04/06/deploying-the-mvc-html5-editor-to-azure-app-services/llms.txt)
- [Best Practices for Adding Ribbon Tabs, Groups and Buttons to the TXTextControl.Web Ribbon Bar](https://www.textcontrol.com/blog/2017/12/21/best-practices-for-adding-ribbon-content-to-txtextcontrol-web/llms.txt)
- [X15: Adding MS Word Compatible Fields and Form Elements to TXTextControl.Web](https://www.textcontrol.com/blog/2017/12/20/using-ms-word-form-elements-in-txtextcontrol-web/llms.txt)
- [X15: Inserting Client-Side Images using JavaScript](https://www.textcontrol.com/blog/2017/12/14/inserting-client-side-images-using-javascript/llms.txt)
- [Sneak Peek X15: Contextual Chart Ribbon Tabs](https://www.textcontrol.com/blog/2017/07/20/sneak-peek-x15-contextual-chart-ribbon-tabs/llms.txt)
- [ASP.NET MVC: Implementing a Simplistic, Custom Button Bar](https://www.textcontrol.com/blog/2017/03/13/aspnet-mvc-implementing-a-simplistic-custom-button-bar/llms.txt)
- [ASP.NET MVC: Adding Protected Sections to Documents](https://www.textcontrol.com/blog/2017/03/01/aspnet-mvc-adding-protected-sections-to-documents/llms.txt)
