Display Developer Notification in Episerver Admin Mode

In EPiServer

This blog post is about how to display a notification for developers in Episerver Admin Mode, highlighting that they’re in a development environment. The lack of notification strongly suggests caution.


Switching between development, test and production environments can sometimes be a hassle. Worse so, it can sometimes be downright dangerous. Especially if you’re running an Episerver multisite-solution. Switching between start pages in the content tree will prompt the user to login again. If you’ve restored your development database from a production version then the default URL will be that of production. If you’re not careful, you might find yourself in a production environment, doing developer business.

By default there’s no indication in Episerver that you’re in a production environment (running on a production license) other than a small message in the left hand corner in Episerver admin mode.



I discussed the problem with fellow developer Ted Nyberg at the last Episerver MVP Summit. What’s the easiest way to “hack” admin mode without actually modifying any of the core Episerver files? Why, a HTTP module that modifies the markup, granted that we’re in admin mode.

The solution is built using three components: the HTTP module itself, a HTTP filter to modify the response markup and an Episerver License helper class.

The HTTP module

In the HTTP module we check if the current request is for Episerver admin mode.  If it is, then we attach a filter to the HTTP response, which will modify the markup.

The HTTP filter

The HTTP filter simply replaces the default </body> element with our own markup along with some fantastic in-line styling. Also note the License Helper class which we need to determine what type of license we’re running on. Admittedly, the notification message styling could be less obtrusive. As it is now some functionality might not be accessible as the div is fixed.

The Episerver License Helper class

The main thing we need to retrieve using the License Helper class is the LicenseCheck instance, which is marked as private in the Episerver Licensing class. We need it in order to check if the license is commercial or not. We also retrieve the License message, i.e. “Product licensed to Daniel Berg Sogeti”, which is a method named GetErrorMessage in the Episerver Licensing-class.

Config transform

The final ingredient we’ll add to the mix is a config transform that will only inject the HTTP module into web.config if we’re running in a local or test environment.

The result

If we navigate to the admin mode of the Episerver website, then the HTTP module adds the filter to the response and modifies the response markup, displaying a developer notification.


And that’s it. Now a notification will be displayed for developers if they’re running in a development or test environment and they’re using a non-commercial license. I would argue that it’d be great if this was built-in with the CMS.

Are you doing it differently? Comments below!

Thanks for reading!

Recommended Posts
  • Nicely done! That would also help noticing if a non-commercial, i.e. expiring, license has accidentally been deployed to a production environment. 🙂

    • Daniel Berg

      The possibilities are endless! 🙂

Contact Us

We're not around right now. But you can send us an email and we'll get back to you, asap.

Not readable? Change text. captcha txt

Start typing and press Enter to search