Skip to content

ASP.NET Core StatusCodePages powered by the Xperience Content Tree.

License

Notifications You must be signed in to change notification settings

BizStream/xperience-status-code-pages

Repository files navigation

xperience-status-code-pages License

ASP.NET Core StatusCodePages driven by the Xperience Content Tree.

Usage

  • Install the Administration package into the CMSApp project
Install-Package BizStream.Kentico.Xperience.Administration.StatusCodePages
  • Install the AspNetCore package into the Xperience ASP.NET Core Mvc project:
dotnet add package BizStream.Kentico.Xperience.AspNetCore.StatusCodePages

OR

<PackageReference Include="BizStream.Kentico.Xperience.AspNetCore.StatusCodePages" Version="x.x.x" />
  • Configure services in the Startup.cs of the Xperience Mvc project:
using BizStream.Kentico.Xperience.AspNetCore.StatusCodePages;
using Microsoft.Extensions.DependencyInjection;

// ...

public void ConfigureServices( IServiceCollection services )
{
    services.AddControllersWithViews();

    // ...

    services.AddXperienceStatusCodePages();
}

public void Configure( IApplicationBuilder app, IWebHostEnvironment environment )
{
    if( environment.IsDevelopment() )
    {
        app.UseDeveloperExceptionPage();
    }
    else
    {
        app.UseXperienceStatusCodePages();
        app.UseHsts();
    }

    // ...
}
  • Register the Page Route in the Xperience Mvc App:

We recommend creating a RegisterPageRoutes.cs file in the root of the Xperience Mvc project for usage of the RegisterPageRouteAttributes.

using BizStream.Kentico.Xperience.AspNetCore.StatusCodePages;
using Kentico.Content.Web.Mvc.Routing;

// For "out-of-the-box" functionality
[assembly: RegisterStatusCodePageRoute]

// OR

// To use a custom Controller
[assembly: RegisterPageRoute( StatusCodeNode.CLASS_NAME, typeof( MyStatusCodeController ) )]

About

ASP.NET Core StatusCodePages powered by the Xperience Content Tree.

Topics

Resources

License

Stars

Watchers

Forks

Languages