Run the .NET Core sample app
In this guide, you'll learn how to run an ASP.NET Core MVC sample app and see your project's content in your browser. The sample app will show content from a sample project and you'll also get to change a thing or two in the project.
New to Content as a Service?
If you are new to the world of Content as a Service (CaaS), you might want to start by building a Hello world application.
After you grasp the core idea behind CaaS, everything in the sample application will make a lot more sense much faster.
Table of contents
Sample project for the app
The sample app displays data from the Sample Project that demonstrates our best practices and features of Kontent. If you don't have it yet, create your own sample project, it only takes a minute.
This full-featured project contains marketing content for Dancing Goat – an imaginary chain of coffee shops. Once you run the sample app, you'll see content from the Sample Project displayed in your browser.
Run the .NET Core MVC sample app
Before going any further, make sure you have the following:
- An IDE (such as Visual Studio 2019 or later)
- .NET 5 SDK
- Node.js 14 or later
- A Kontent by Kentico account
1. Download the app
The source code of the sample application lives in a Github repository.
If you are used to working with Git, you can clone the repository to your computer by typing the following to your console:
- shellgit clone https://github.com/Kentico/kontent-sample-app-net.git
git clone https://github.com/Kentico/kontent-sample-app-net.git
If you don't have Git installed, you can directly download the sample application as a ZIP file, extract it, and continue from there.
2. Run the app
- Open the solution in your IDE (using the DancingGoat.sln file).
- Build the solution.
- In the DancingGoat folder, run
npm install && npm run buildto install the packages and build styles.
- Run the application (in Visual Studio, choose Debug > Start Without Debugging or hit CTRL + F5).
The application will open automatically in your browser at
3. Connect your Kontent project
When you run the application for the first time, you will see a Configuration page. Use it to connect the app to your Sample Project in Kontent:
- Click Get project ID from Kontent. A new browser window will open.
- Sign in to your account or create a new one.
- From the list of your projects, select the Sample Project.
- Click Select project.
The application now displays content from your Sample Project.
You can also set the project ID manually in the app settings.
Now, let's explore the Sample Project and update its content so that you can see the changes reflected in your locally running application.
Making changes to your project
Try to edit an article from the sample project:
- From the app menu, choose Content & assets.
- Open a published article, for example, the Coffee processing techniques one.
- Look for items with a green Published label and the word Article in the Type column.
- Create a new version to edit the article.
- Make a change in the article, for example, edit the Title text or some other element.
- Publish the changes to see them in the sample app.
Voila! You have successfully updated content in your Sample Project. Refresh the browser window with your application to see the changes on the website.
Feel free to further explore how the content in your sample project is structured.
Exploring content structure
To see details about the opened content item, go back to Kontent and click Content details in the top right. Under Content type, notice that the item is based on the Article content type.
To open the content type for editing, click Article in the content details.
How content is structured in Kontent
Each content item is based on a single content type. A content type is a template that defines the structure of the content item – which elements it contains, their names, limitations, guidelines, and so on.
Mix and match the available elements to define your own content types.
Deploy the .NET Core sample app
You can deploy the application to Azure or another hosting service:
- Deploy to Azure using Visual Studio tutorial
Kontent makes no assumptions about how your content is displayed. It simply delivers it via a RESTful Delivery API to any application that asks for it – be it a website, mobile app, chatbot, electronic billboard, virtual voice assistant, or an internet-enabled toaster.
We deliver the content, you do whatever you want with it – using the technology of your choice.
A traditional CMS would force you to put your content into neatly arranged boxes to fit inside a pre-defined template. The power of Kontent comes from not getting in your way. Content structure and content presentation are truly separated and you have the flexibility to define both according to the needs of your project.
- Check out .NET Core Razor Pages sample app for a page-focused approach to building .NET Core apps with Kontent.
- Have a look also at the pre-built templates for Kontent to quickly get your site running.
- If you're ready to dive in, try to build your own .NET website from scratch
- We also recommend you take a look at our SDKs for .NET.