Agility and .NET

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.

Why .NET with Agility CMS?

.NET is Microsoft's powerful, cross-platform framework for building modern web applications. Combined with Agility CMS, you get:

  • Server-Side Rendering (SSR) for SEO-friendly, fast-loading pages
  • Editor-Driven Pages where content editors control the sitemap without developer intervention
  • Flexible Content Modeling with strongly-typed C# classes
  • Enterprise-Ready architecture with built-in caching and performance optimization
  • Azure-Native deployment with one-click setup

Choose Your Starter

We provide two production-ready starters for building websites with Agility CMS and .NET:

StarterFrameworkBest ForInteractivity
Blazor SSRBlazorModern apps, interactive UIsServer-side + optional SignalR
MVCRazor PagesTraditional web appsServer-side only

Both starters include:

  • Dynamic page routing based on Agility sitemap
  • Component-based architecture
  • Preview mode support
  • Tailwind CSS styling
  • One-click Azure deployment

The Agility SDK

The Agility .NET SDK consists of a NuGet package for accessing content:

Agility.NET.FetchAPI

dotnet add package Agility.NET.FetchAPI

Capabilities:

  • Fetch pages and sitemaps
  • Retrieve content items and lists
  • Query content via GraphQL
  • Handle preview mode
  • Typed responses with generics

Quick Start

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.

Documentation

Getting Started

Starters

Core Concepts

Development

Deployment & Operations

Sample Code

Fetch a Content List

// Using the FetchApiService
var posts = await FetchApi.GetTypedContentList<Post>(
    referenceName: "posts",
    locale: "en-us",
    take: 10
);

Render a Component (Blazor)

@* RichTextArea.razor *@
<div class="prose max-w-none">
    @((MarkupString)(Fields?.TextBlob ?? ""))
</div>

@code {
    [Parameter] public RichTextArea? Fields { get; set; }
}

Render a Component (MVC)

// 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>

Resources

Get Help