Check for Preview in .NET 8.0

Leif Anderson asked on February 9, 2024 15:57

I am migrating an app from .NET Framework 4.8 to .NET 8.0. There is a method we use to check if you're currently in preview mode: System.Web.HttpContext.Current.Kentico().Preview().Enabled. This comes from the documentation about setting up Previews.

However, in .NET 8.0, I'm not seeing this. Is this functionality supported?

Recent Answers


Juraj Ondrus answered on February 11, 2024 07:24

In .NET Core development model, please try using HttpContext.Kentico().Preview().Enabled instead.

0 votesVote for this answer Mark as a Correct answer

Elmar Höfinghoff answered on February 20, 2024 10:16

Or just @Context.Kentico()... in Razor Views

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.