In this tutorial, you will learn how to check if a page request is in either preview or edit mode within Episerver CMS. There are a number of situations when building your frontend views within Episerver where you may want to display information differently if the page is being viewed by a content editor, rather than a site visitor. For example, you may want to render a different class or display some debug information. The good news is that this is possible and very easy within Episerver, read on to learn how 🔥🔥🔥


In Episerver there are three page rendering modes:

  • A normal web request
  • A request made in the editor
  • A preview request

You can check the request is a preview request by using CurrentContextMode:

It is possible to determine if a request is in edit mode, using the PageEditing helper:

If the page is in edit mode, the helper will return true, simples 😊. If you want to get the edit Url for any page, you can use the GetEditUrl() method like this:

Using these helpers should allow you to differentiate between the different requests. Happy Coding 🤘