Introduction
Step-by-step guide to getting started with Agility CMS and .NET — Blazor SSR and MVC/Razor Pages starters, content fetching, and Azure deployment.
Build fast, SEO-optimized websites using .NET and Agility CMS. Whether you're creating a marketing site, blog, or enterprise application, this guide will help you leverage the power of .NET with Agility's headless CMS.
.NET is Microsoft's powerful, cross-platform framework for building modern web applications. Combined with Agility CMS, you get:
We provide two production-ready starters for building websites with Agility CMS and .NET:
| Starter | Framework | Best For | Interactivity |
|---|---|---|---|
| Blazor SSR | Blazor | Modern apps, interactive UIs | Server-side + optional SignalR |
| MVC | Razor Pages | Traditional web apps | Server-side only |
Both starters include:
The Agility .NET SDK consists of a NuGet package for accessing content:
dotnet add package Agility.NET.FetchAPI
Capabilities:
Clone the starter repository and choose your preferred framework:
git clone https://github.com/agility/agilitycms-dotnet-starter.git
cd agilitycms-dotnet-starter
# For Blazor SSR
cd Agility.NET.Blazor.Starter
# Or for MVC/Razor Pages
cd Agility.NET.MVC.Starter
# Configure your credentials in appsettings.local.json
# Then run
dotnet watch
See the Getting Started guide for detailed setup instructions.
// Using the FetchApiService
var posts = await FetchApi.GetTypedContentList<Post>(
referenceName: "posts",
locale: "en-us",
take: 10
);
@* RichTextArea.razor *@
<div class="prose max-w-none">
@((MarkupString)(Fields?.TextBlob ?? ""))
</div>
@code {
[Parameter] public RichTextArea? Fields { get; set; }
}
// ViewComponent
public class RichTextArea : ViewComponent
{
public IViewComponentResult Invoke(ModuleModel module)
{
var fields = module.Model.Fields.ToObject<RichTextAreaFields>();
return View(fields);
}
}
@* Views/PageModules/RichTextArea.cshtml *@
@model RichTextAreaFields
<div class="prose max-w-none">
@Html.Raw(Model?.TextBlob)
</div>