Mathias Kunto's blog

    • About Mathias and this blog
    • Norrlandsboks webbshop hos Publit
  • Updated Exception enrichment functionality for added safety

    Here is an improved version of the Exception enrichment functionality described in the article Enriching your exceptions with information from Episerver. Updates has been made in order to make it more robust in regards to usage of abstract classes that may in some cases throw NotImplementedException, causing the enrichment code to terminate.

    October 13, 2025
  • Allow only certain number of items in ContentAreas in Optimizely

    Here is a validation attribute that I wrote in order to limit the number of items that editors may put in Optimizely ContentAreas to a specific set of numbers, instead of having max and min values. The part that may be of interest to highlight is the possibility to skip validation in certain cases, for…

    October 12, 2025
  • Hiding and showing edit mode properties on same content type in Optimizely CMS depending on context

    At my current client we have the need to hide or show properties for editors in Optimizely edit mode, on the same page type, depending on where/how the page type is used. Our structure consists of global pages, and local instances of the same pages. There are times when global editors should be able to…

    October 11, 2025
  • Changing Optimizely property return type yields MissingMethodException on getter

    I was faced with a somewhat unexpected MissingMethodException changing a property type from string to XhtmlString while making changes to an Optimizely website for my current client. I’ve done this sort of change on mant occations, and moving from a string to an XhtmlString should not cause a problem. The exception seemed to be thrown…

    June 28, 2025
  • Object reference not set to an instance of an object in EPiServer.Shell.Web.Mvc.HttpContextBaseExtensions.SetCulture method

    I ran in to this problem setting up an older Optimizely website running on .Net Framework. The view mode of the website worked just fine, however, when trying to access the edit mode via /episerver/cms, the following exception was thrown. Getting at least some hints from the post Object Reference while trying to access epicms…

    June 14, 2025
  • Injecting Fragments in Optimizely XHtmlStrings

    Injecting fragments in Optimizely XHtmlStrings is quite easy using a custom display template to render the property. Here is an example on how you can inject custom data based on Optimizely blocks dropped in the XHtmlString property. I’ve been using an approach similar to this to inject ids used for anchor tag navigation also within…

    June 24, 2024
  • Clearing output cache in a multi server environment

    This is a follow up to the previous Acting on Optimizely Remote Events article. While still working with the older Optimizely 11 you may rely on the Remote Event functionality to clear cache. However, in some cases you may need to build on this functionality to clear the output cache on other servers manually. In…

    May 25, 2024
  • Prevent certain Optimizely visitor groups from being used in content areas

    At my current client we had the need to prevent the use of certain visitor groups in some of the content areas. I.e. some areas were only to support national content, and other areas only regional content (where each region had a different visitor group). Here is a solution making use of ValidationAttribute. The visitor…

    October 14, 2023
  • System.Data.SqlClient.SqlException: Invalid column name ‘IsApproved’, ‘IsLockedOut’, ‘Comment’, ‘CreationDate’, ‘LastLoginDate’, ‘LastLockoutDate’

    Got this SqlException again moving a database from a client’s production environment into development. Thought I’d write a short note on resolving it. Check the migration history table: It is likely that the initial create of the tables used Microsoft.AspNet.Identity.EntityFramework.IdentityUser instead of the expected EPiServer.Cms.UI.AspNetIdentity.ApplicationUser. The ContextKey column would contain EPiServer.Cms.UI.AspNetIdentity.ApplicationDbContext`1 [Microsoft.AspNet.Identity.EntityFramework.IdentityUser] rather than EPiServer.Cms.UI.AspNetIdentity.ApplicationDbContext`1…

    June 17, 2023
  • Acting on Optimizely Remote Events

    Just a short piece on how to act on Optimizely‘s remote events. While in later versions you may use for instance RabbitMQ or ActiveMQ, still being on 11 will have you using the older event distribution. For attaching your own handlers to the received event, you will need to get an instance of the IEventProviderAccessor…

    May 20, 2023
  • Using ActiveMQ with Optimizely 12

    Whilst setting up Optimizely 12 to work with RabbitMQ is rather straight forward, making it use ActiveMQ for transport instead requires a bit more configuration on our part. Here is a short article on how to set up Optimizely 12 to use MassTransit (EPiServer.Events.MassTransit) with ActiveMQ. For a short instruction on how to set up…

    March 16, 2023
  • ActiveMQ tester application with topic support

    I’ve updated the ActiveMQ tester application with topic support as it is required by the Optimizely on-prem event provider (EPiServer.Events.MassTransit). Otherwise, the usage is as before (see ActiveMQ connection tester application). Source code at GitHub.

    March 16, 2023
  • ActiveMQ connection tester application

    While moving our client’s Optimizely 12 website to a new hosting provider we had to abandon our RabbitMQ installation in favour of a new ActiveMQ one, also supported by the on-prem event provider (EPiServer.Events.MassTransit). To make it easier setting this up I rewrote the old RabbitMQ connection tester application into a new one working with…

    June 10, 2022
  • Episerver Remote Events tester console application for framework 4.8 and Optimizely 11

    My current client is moving their Optimizely 11 websites to a new hosting provider and we need an easy way to test the remote event replication system. I remember that there was an old console application for this back in the day, but when I found a copy of it I realized that it required…

    May 28, 2022
  • RabbitMQ connection tester application

    We set up Optimizely‘s new on-prem event provider (EPiServer.Events.MassTransit) for my current client’s Optimizely 12 website the other week. At current date it is still in beta until there are enough uses for there to be a production release. For the mass transit we set up RabbitMQ. For earlier Optimizely (Episerver) versions built on ASP.NET…

    February 20, 2022
  • Simple way to use enums for sorting in Optimizely Search & Navigation

    As stated in the Optimizely Search & Navigation developer documentation on Sorting, “Sorting is supported for numerical types such as int, double, DateTime, and string”. This means that you will get an error from EPiServer.Find.SortingValidationHelper.ValidateSupportedType if you attempt to sort on an enum field. There are of course various solutions to this problem, but here is…

    February 12, 2022
  • Finding the latest Optimizely Search & Navigation’s client Javascript URL

    I got a question on how to find the latest version of the Search & Navigation /epi-util/find.js script file after publishing the article Proxy for Optimizely Search & Navigation tracking script. It is really quite simple, if you look at how Optimiezely does things. The solution is to make use of the built-in IPathHelper (namespace…

    February 6, 2022
  • Proxy for Optimizely Search & Navigation tracking script

    When using Optimizely Search & Navigation (previously Episerver Find) you will automatically get a reference to a client side Javascript injected into your markup. Occationally, you may want to proxy it via your Optimizely website’s backend, caching it or just make it appear as if it comes from your own domain. It may also be…

    February 3, 2022
  • Getting the root PageReference of the imported pages in Episerver

    In our work to automate export and import of the production database into our test environment we had to maintain a test node in the Episerver page tree. This ment that we had to export it before replacing the database, and then import it again. Please see Exporting Episerver content programmatically through an ApiController and…

    April 19, 2021
  • Importing Episerver content programmatically through an ApiController

    Importing the test node package that we exported earlier (see article Exporting Episerver content programmatically through an ApiController) would be the next step in our automated transfer of the production database to the testing environment. I extended our ApiController with an import endpoint for this purpose. Note that this code is never intended to be…

    April 18, 2021
1 2 3 … 9
Next Page→

Mathias Kunto's blog

Proudly powered by WordPress