Category Archives: .net

.NET Session state is not thread safe

When working with the .NET session state you should bear in mind that the HttpContext.Current.Session cannot be transferred to another thread. Imagine that you, from the Global.asax would like to read the SessionID each time a session is started: To … Continue reading

Posted in .net, c#, General .NET | Tagged , , , , , , | Leave a comment

Webhook Event Receiver with Azure Functions

Microsoft Azure Functions is a solution to run small pieces of code in the cloud. If your code is very small and have only one purpose, an Azure Function could be the cost effective solution. This is an example of … Continue reading

Posted in .net, c#, General .NET, Microsoft Azure | Tagged , , , | Leave a comment

Sitecore ContentSearch – Get items from SOLR or Lucene – A base class implementation

Reading items from Sitecore is pretty straight forward: And it is fast, unless you need to retrieve items from many paths, or need to retrieve every child of a certain base class. In these situations you resolve to using the … Continue reading

Posted in .net, c#, General .NET, Sitecore 7, Sitecore 8 | Tagged , , , , , , | Leave a comment

Sitecore user:created event not fired on Membership.CreateUser

Sitecore have since 7.5’ish fired events each time you manipulate the users in the .NET Membership database: But I noticed that the user:created event was not fired. This is because I call the .NET Membership provider directly: This call to … Continue reading

Posted in .net, c#, General .NET, Sitecore 7, Sitecore 8 | Tagged , , , , , , , , | Leave a comment

Sitecore ContentSearch Get Latest Version

The Sitecore ContentSearch API allows you to index content in either .NET Lucene or SOLR, dramatically speeding up retrieval of content, especially when querying items that are scattered across your content tree. Content retrieved from the ContentSearch API is not … Continue reading

Posted in .net, c#, General .NET, Sitecore 7, Sitecore 8 | Tagged , , , , , | 1 Comment

Sitecore Caching – Clear caches individually

The Sitecore caching engine is a simple yet powerful tool where Sitecore not only stores it’s own data for fast retrieval, but allows you to store your own data of any kind. Sitecore have a built in overview of the … Continue reading

Posted in .net, c#, General .NET, Sitecore 7, Sitecore 8 | Tagged , | 2 Comments

Sitecore General error when submitting contact – Another contact with the same identifier already exists

In Sitecore when creating your own contacts you can get the following exception: 10604 10:16:27 ERROR General error when submitting contact. Exception: System.InvalidOperationException Message: Another contact with the same identifier already exists. Source: Sitecore.Analytics.MongoDB at Sitecore.Analytics.Data.DataAccess.MongoDb.MongoDbDataAdapterProvider.SaveContactWithIdentifier(IContact contact, ContactSaveOptions saveOptions) at … Continue reading

Posted in .net, c#, General .NET, Sitecore 8 | Tagged , , , , , | 2 Comments

Sitecore Advanced Configuration in .config files

Sitecore allows you to create configuration sections in /configuration/sitecore/ that consists of hierarchies of configurations including lists, and it will even help you serialize the configuration to object instances. Observe the following real life example of a configuration I created to … Continue reading

Posted in .net, c#, General .NET, Sitecore, Sitecore 5, Sitecore 6, Sitecore 7, Sitecore 8 | Tagged , , , , | Leave a comment

Azure CloudQueue, Get and Set Json using Newtonsoft.Json and Microsoft.WindowsAzure.Storage

The Microsoft Azure Cloud have a nice simple Queue mechanism in their Azure Storage where you can store up to 64 kb of data for up to 7 days. The queue is very easy to set up and very easy … Continue reading

Posted in .net, c#, General .NET | Tagged , , , , | 1 Comment

Sitecore Contacts – Create and save contacts to and from xDB (MongoDB)

The Sitecore Contact is the cornerstone of the Sitecore Experience Platform and is the place where you store every data you know about any contact, named and anonymous. UPDATE: 09-09-2016: CreateContact Updated: Thanks to moginheden for the update. UPDATE: 27-09-2016: … Continue reading

Posted in .net, c#, General .NET, Sitecore 8 | Tagged , , , , , , , , | 15 Comments