Friday 27 February 2015

Using Membership with Sitecore

Sitecore's authentication and user management uses asp.net membership with the membership schema in the Core database.  To use authentication in your own sites you can use this membership system yourself, or if you have your own existing membership database you want to use, or you want to implement membership on your site and don't want to use a separate database rather than keeping your users in the Core database, then it is possible to configure Sitecore to implement multiple asp.net membership databases.

Tuesday 3 February 2015

How Sitecore manages icons

Introduction


Any Sitecore developer knows that building a Sitecore solution is 20% writing code and 80% choosing icons.  You might not have given icon management any thought, but not only is it possible to create your own icons for use with Sitecore, but there are already more icons available to you than you think.

Sitecore pipelines in high volume sites

Introduction


If you use class-level variables in your Sitecore pipelines you might discover inconsistent and unwanted behaviour.

Using .net caching with Sitecore

Introduction


Sitecore has an extensive caching framework that allows it to cache everything from items in its database all the way to the html output of its renderings.  When using Sitecore's cache framework it employs a number of techniques to ensure that the cached data remains valid, and if you use .net's own caching framework this can sometimes conflict with Sitecore.  For example, let's say you have a menu control that appears on every page so you use .net's output caching to cache the html.  If a content editor changes something in Sitecore that affects your menu such as creating new elements, renaming titles etc, then your site is going to continue serving up the cached version which is no longer valid.  If you use Sitecore's own caching framework by setting cache parameters on the rendering then Sitecore will clear these cached items when a publish happens, ensuring that the cached html is rebuilt using the new data.  Furthermore, Sitecore will disable caching when you are in preview or edit mode so you know your data is always fresh.

As well as html caching, you might want to cache data structures you have built from Sitecore items.  Let's say you have a list of countries and in each country is a list of cities and you use this data often, so would like to cache it.  If you use .net caching and the underlying data in Sitecore changes, your cached data is now invalid.  You could set an expiry on the cache, but that's far from ideal as you don't want to tell your content editors that they have to wait before they see their changes go live.
In this article I am going to show you how to hook into the publishing mechanism such that your cached items are removed when a publish occurs.