ASP.NET Web API 2 – Enable Sitecore Context Session State

How do I bring that big thing back into the context?

How do I bring that big thing back into the context?

ASP.NET Web API 2 is designed as a stateless Web API framework, therefore, the visitor session context is not automatically created on each web request. Normally, for a Sitecore solution, it is necessary to enable Sitecore Context session-dependent features/data in some or even most of Web API calls context.

The Solution

One of the options is to create Web API Route which would automatically enable session state for all Web API calls that are made via this route. To be clear, we are basically looking for enabling a regular ASP.NET session state in the context of ASP.NET Web API 2 calls.

The solution option which we consider in this specific case has the following implementation approach:

  1. Register a new route using ASP.NET Web API 2 – a dedicated route for the session-context-enabled Web API calls handling.
  2. Retrieve the new route’s object using a regular ASP.NET and enrich it with a request handler that creates a regular ASP.NET session state context.

The Code

(mehr …)

Sitecore Path Analyzer: how to undeploy / remove a deployed map configuration

Path Analyzer - Undeploy Map Configuration - Teaser

When creating new/custom Path Analyzer maps in Sitecore, sometimes the chosen data does not match the desired result or there is an error in the rules configuration (making them „not working“) – in such cases, it would be helpful to … Weiterlesen

How to Create a Rule in Sitecore to automatically fill an empty field with existing content

Using the Sitecore Rule engine for solving a use case for automatically filling a field in Sitecore, when saving a page item: an empty Page Description field should inherit the content of an existing Introduction field. Weiterlesen

Prereleases for NitroNet 2.0.0 & NitroNetSitecore 2.1.0 available now!

With extensive updates to the documentation, some small code fixes and improvements, the 2.0.0 version of NitroNet introduces also a brand-new feature called Additional Arguments which allows to be more flexible and more compatible with the handlebars templates created with Nitro by the friendly frontend engineer of your choice. Weiterlesen

Analysis of an issue with Sitecore AccessResultCache running full and being cleared continuously despite large cache size

Disaster girl meme adapted for explaining impact of expensive Sitecore item query on AccessResultCache

We recently had a situation, where we quickly had to grab a virtual whip in order to tame the Sitecore AccessResultCache from going crazy – in terms of reaching it’s allocated size within seconds and thus being constantly cleared by Sitecore.Caching.Generics.Cache

Previewing component personalization conditions in Sitecore Experience Editor not working

Teaser showing a Sitecore component personalization condition preview not working

You may be working with personalization conditions on components in the Sitecore Experience Editor, and when trying to preview any of your condition rules – simply nothing changes.

Store Item „Published date“ and „Published by“ information on each Sitecore item

Sitecore Publish Statistics for Published by and Published date - Teaser

Did you ever miss that Sitecore doesn’t keep track of who published which item(s) at what date? Well, be not sad no longer! In this blog post you’ll find a neat solution to store the „Published date“ and „Published by [user]“ information on all Sitecore items – so it’s finally possible to blame the right person who published too many items once again 😉 Weiterlesen

Upgrading to Sitecore 9.0 Update-2 and later versions might change the order of renderings

Sitecore 9 Update 2 change order of renderings - Teaser

After running the Update Installation Wizard for a Sitecore solution from Sitecore 8.1 Update-1 to Sitecore 9.0 Update-2 we discovered that the order of most of the renderings on page items had changed. Beforehand we already tested an upgrade with Sitecore 9.0 Update-1 for this solution and it worked perfectly fine. This implied that something must have changed between Sitecore 9 Update-1 and Update-2. Weiterlesen

Sitecore field types – a visual cheat sheet

Sitecore Field Types Screenshots - Teaser

There is no actual *visual* documentation of the currently available field types in Sitecore. In this post we are filling that gap and provide you with actual screenshots in addition to the existing documentations. Weiterlesen