SaaS CMS has officially launched! Learn more now.

Scott Reed
Nov 17, 2021
  1960
(3 votes)

Restore Root CMS episerver Login Path In .NET 5

Introduction

With the release of CMS 12 there was the removal of dashboards which has caused the base login path to not work when created in a new project via the steps documented here https://world.optimizely.com/documentation/developer-guides/CMS/getting-started/creating-a-starter-project/ 

Now with the out of the box code you have to navigate to /episerver/cms to access the CMS Editing area.

Although you can change the path to the CMS editing experience with the documented approach https://world.optimizely.com/documentation/developer-guides/CMS/configuration/changing-edit-and-admin-view-urls/ it does not work to change this to just /episerver as there needs to be a subpath for the CMS experience.

Solution

Using the ASP.NET Rewriting Middleware https://docs.microsoft.com/en-us/aspnet/core/fundamentals/url-rewriting?view=aspnetcore-5.0 we can add a redirect to reirect /episerver to /episerver/cms

First add the nuget package

dotnet add package Microsoft.AspNetCore.Rewrite --version 2.2.0

Then add in the redirect to the Startup.cs configure code

var options = new RewriteOptions().AddRedirect("episerver$", "episerver/cms");
app.UseRewriter(options);

Conclusion

This is something simple but I've seen people confused https://world.optimizely.com/forum/developer-forum/CMS/Thread-Container/2021/11/cms12-emptystarter-project-not-working/ therefore I wanted to post about it and propose an easy solution to remedy the problem. Ideally when you go to the root /episerver as everyone is used to doing you want to go to the CMS which this will do.

Also as a note now that Episerver is no longer the company name it strikes me odd to preserve it so I would follow the approach in https://world.optimizely.com/documentation/developer-guides/CMS/configuration/changing-edit-and-admin-view-urls/ anyhow and consider changing the default URL path to remove the old brand. Such as /cms/cms with a redirect from /cms &  /episerver to /cms/cms or any name of your choice :-) 

Happy coding!! Add any thoughts, errors or suggestions in the comments below!!

Nov 17, 2021

Comments

Please login to comment.
Latest blogs
Optimizely SaaS CMS Concepts and Terminologies

Whether you're a new user of Optimizely CMS or a veteran who have been through the evolution of it, the SaaS CMS is bringing some new concepts and...

Patrick Lam | Jul 15, 2024

How to have a link plugin with extra link id attribute in TinyMce

Introduce Optimizely CMS Editing is using TinyMce for editing rich-text content. We need to use this control a lot in CMS site for kind of WYSWYG...

Binh Nguyen Thi | Jul 13, 2024

Create your first demo site with Optimizely SaaS/Visual Builder

Hello everyone, We are very excited about the launch of our SaaS CMS and the new Visual Builder that comes with it. Since it is the first time you'...

Patrick Lam | Jul 11, 2024

Integrate a CMP workflow step with CMS

As you might know Optimizely has an integration where you can create and edit pages in the CMS directly from the CMP. One of the benefits of this i...

Marcus Hoffmann | Jul 10, 2024