Solving strange errors when updating more items in hooks

Sometimes when you’re updating item in hooks, you’ll receive strange error messages in the client. The reason for this is quite clear. Sitecore has an event system divided in 2 parts: the regular events such as item:created. The other one is the NotificationContext. This particular class is used by the Sitecore client to get notified before time intensive actions such as event broadcasting is done.
You can use this functionality as well by simply subscribing to the delegates in Sitecore.Context.Notifications.

But what if you’re updating or manipulating your repository triggered by a client action? Exactly, the client has subscribed to a specific action, but when the event will be triggered, a collection has changed or a DataContext is missing. The solution is easy: use Sitecore.Data.BulkUpdataContext in a using statement:

using(new Sitecore.Data.BulkUpdate())


//Your update code


Nobody gets notified, but important events(configured in the web.config/include files) will get triggered.

Have fun coding!

The world is changing…

You can feel it everywhere! Lord of the Rings starts with these sentences.
So does my new project. I’m not going to reveal anything. But some parts might be interesting for you. On January 1st 2009, I’ll start of with a new website. This website is rather a project then just a single website. It all has to do with Web 2.0, Social Networking, but also Sitecore. It’s all about experiencing what goes around on the web these days. And how to take advantage of it.

On technical side: I’m developing a close integration of Sitecore with all kinds of social networks / web 2.0 services. When I’m talking about close, we’re talking this time about tight! Using Sitecore as data aggregator in several ways. But also a web 2.0  portal and main distribution channel.

Expect my sources to be published on our shared source repository somewhere February. When everything is stable.

More info upcoming later this week.

Show Sitecore how to improve…

Sitecore is alive and kicking. A lot is happening internally on product development. New modules and integrations with technology partners get released at the same speed as Bugatti Veyrons get sold ;). In new (even emerging) markets such as Australia, South Africa, Israel, Asia and New Zealand, Sitecore becomes the standard for Web Marketing.
Yeah that’s right: Web Marketing. More then ever Sitecore becomes a tool for the Marketers. Once again: yes, just the tool. IT grows up, we are more then often just the tool to reach goals. Information goals, conversion goals and even more physical commercial goals such as direct sale.

All of this doesn’t mean that Sitecore forgets where we came from. Very often Lars Fløe Nielsen and I have talks about the incredible number of developers who work with Sitecore, other Sitecore technical numbers like our implementations but also namespaces, classes and methods in our product(s). Both Lars and I are very proud when we look at Sitecore as a company. Almost 50% of our colleagues are involved in Product development. When I’m talking about involved, this doesn’t mean that they contribute code to the repository, but rather talk on a daily base about product directions. We supply our feedback, feeded by our outstanding power team of partners and customers, in a well formed way to product development. In this way there’s no way for them to find excuses for such another outstanding improvement in the product. We provide the exact reason, the pain and possible solution. Together with the right business case supplied by you out there, we’re able to remain world leading in innovative content management :).

This morning in the train I’ve been thinking how to address some of the issues of our developer customer around the world. The guys who are writing and rewriting code on a daily base. A lot of you have made us famous inside your company. So we should listen to you guys as well. Like I said, we try to do this always, but sometimes, it’s good to trigger people. So please! go ahead, react on this post. Tell us what we should do better, what we should different, what’s working what not. I’m particular interested in what makes your process less time intensive and more efficient.
Should we come up with a Visio shape for designing your data? Or should we deliver you a templated WebControl for our advanced types? Is a part undocumented what should be documented? Please let me know.
But please note one thing: I’m looking for feedback, not for a flame war. This is my first try to do this. Hopefully we can start a dialogue more often.

So please go ahead!

CM Innovation in Belgium

This Thursday, Christian Daems is showing the world of Content Management and Internet Innovation in Bruxelles, Belgium. A real cool event.

Sitecore is one of the biggest sponsors of this event. I’ll be there together with some of my Danish colleagues and a handful of partners. Please drop by our boot when you want to get to know more about Sitecore. Or in case you want to share some thoughts with me.

Lars Nielsen, one of our Vice Presidents, is opening this event as a keynote speaker.

Hope to see you there!

Upgrade to V6: Explaining it your content editor

At Sitecore we have upgraded our site to version 6. Because of our tightly integration with background systems it took a little moment. But finally we’re there.

As we’ve got 20+ content editors across the globe, the change affected lots of editors. I’ll show you a mail from the head of our marketing department, Paul Markun, to all the content editors:

Hello Content Editors:

Please remember there is a content freeze on until this Monday, Nov 17th.

But , once you do start editing content on Monday or later, the tips that Oksana put together below for editors – specific to our implementation – may be helpful. If you experience any issues please let us know (myself and Oksana). Thanks.


After switching to Sitecore 6.0, you will notice the following few changes in the content editor. These changes are big functionality improvements, but some of them might be a little confusing at first, in particular because we are running in live mode. Live mode means that we use only one database for both working version and published version of the content. In live mode, the workflow is the only mechanism that controls when our changes become visible on the web. So publishing an item in live mode is equivalent to completing the workflow for it; that is, reaching the workflow’s final state.

At this point we keep the workflow for all items the same as before the conversion to Sitecore 6. In this workflow, the item only has 2 states: Edited and Published. In the Published state, the latest saved version of the content item is visible to the web site visitors. In  the Edited state, the previous version of the item is visible on the web , and the latest working version is only available to the content editors, no matter how many times it is saved. When content editors feel that the latest version of an item is ready to be published, they execute the Publish command to move the item to the Published state. Once the item is moved to the Published state, its latest version becomes available on the web site.

There is no approval state in the current workflow and everyone has the ability to publish items they have write access to. In the future we might introduce a more complicated workflow for some items that will require someone else’s approval before the item can be published.

The changes you might notice are:

1. Workflow warning message:
This warning does not apply to the live mode, where publishing is equivalent to moving the item to the final workflow step. So just ignore it and publish the item by clicking the Publish command of the Editing state in Home/Edit menu area as you did previously in 5.3.

2. Validation errors
If you hover over the red vertical line indicating the presence of validation errors, you will see the short validation summary for this field.
Depending on how the validation rules are set up, the errors might or might not prevent you from publishing (or completing the workflow) for this item.
The best practice is to solve all validation issues before publishing your items.

3. Rich text fields are automatically validated to comply with w3c XHTML standards. You can use the Suggest Fix feature to have Sitecore automatically fix XHTML validation errors for you.

4. There are a number of data types that were announced deprecated (or obsolete) in Sitecore 6. These types were superseded by newer, more powerful types.

These are:

Even though the old types are still supported, we have found a few problems with them during our testing. For example, the regional editor would not be able to insert a link to partner’s website because the template used the old Link type.
We tried to fix as many problems as possible, but there is still a chance that there are more. So if you edit an item in on version 6 and encounter a problem such as  not being able to edit a field of the above type, it is because this type has been deprecated in version 6. Please let us know and we will fix it quickly.

And of course, there is a detailed Sitecore 6 content editing reference, available on SDN:


Best Regards,
Paul Markun

VP Marketing

As you can see, our marketing team has confidence – after this short briefing – that we’ll be able to start editing again. I think this is the right approach for your editors as well. They should start working like we do. Instructions of what’s not 100% clear can be done (on individual base) later on.

NOTE: You’re absolutely allowed to use the above description for your editors. But keep in mind that this applies to our specific Sitecore implementation. Some of the points(like Live mode) might not apply at all to your implementation.

Thanks to Paul for allowing me to post this internal email. To my audience: Good luck spreading the word!

So why exactly do we want to move away from Controls to MVC?

Funny, check this post on From handling by Scott Guthrie. Why exactly do we want to move away from the ASP.NET Control model to MVC? To write more code? Even creating a form becomes harder. Wasn’t MVC designed to display… Models? I might be to tired right now to understand this. But I can’t see a clear reason for me to go to MVC Form handling. Everything described was implemented together with LINQ to SQL(or Entities) in 10 minutes, with some generated classes(the LINQ stuff) and 20 lines of HTML and ASP.NET controls, and another 20 lines of boilerplate C# code. Yes I tried it.

I’m missing the clue. Are you still on track? Correct me if I’m wrong, but isn’t making this model development once again more sophisticated? I can see the purpose of MVC for large amounts of data. For a year now I’m writing notes to myself on how to create a DSL for generating this model out of Sitecore. But in ALL my notes, I’ve never mentioned form data. And the funny thing is, in this example you can only use 1 specific url to post your data too.

I don’t want to to Sitecoreish, but one of greatest things about Sitecore is that I can place my forms anywhere and reuse in on any page… I’m getting more unsure where Microsoft has designed the MVC framework for. Scott Guthrie says at the end:

Important: If you don’t like the MVC model or don’t find it natural to your style of development, you definitely don’t have to use it.  It is a totally optional offering – and does not replace the existing WebForms model.  Both WebForms and MVC will be fully supported and enhanced going forward (the next release of ASP.NET WebForms will add richer URL routing features, better HTML markup/client-side ID/CSS support, and more).  So if after reading the above post you think “hmm – that doesn’t feel natural to me”, then both don’t worry, and don’t feel like you should or need to use it (you don’t). 

Let’s say it in another way: I’ve been interesting in the MVC model since the first moment. I hoped it could improve productivity for you guys out there, writing div’s and lists on daily base. With the identical data. So far it seems to be only designed for Database driven applications, similar to phpMyAdmin, but less flexible. That’s not where I was looking for. Hopefully Scott gives us a better impression next time, right now I’m completely unsatisfied with it.

For those who mention that MVC will help us in test driven approaches. You’re 200% right. But… a test driven approach can only succeed when you create software to reach requirements. You can’t write a Unit test in part x of the application when a Unit test in part y of the application tells you the opposite. One of those will fail, certainly. The requirements of our customers are quite clear in general: we want flexible websites which can be controlled from a CMS. So far that seems to be impossible. So a test driven approach doesn’t make sense at all.
Some recent news from our R&D department proved me that I’m not 100% right in this post: we’re trying to be as less dependant of the HttpContext as possible. We’re working on ways to let Sitecore run outside of the HttpContext. No ETA’s and product announcement from me, just to inform you, that we take your requirements(even when it are quality or development requirements) serious.

You might think I’m to critical, guess I’m. But I’ll give MVC, when it will be released, another serious change. Our R&D team believes, like I do, in the pattern itself. We have to look further into it, how and under which circumstances we can support it once released. That will definitely be a nice challenge.

Apple is not always better than Microsoft *Updated*

It’s funny, these days people are extremely pleased about the products from Apple. I’m absolutely happy with the usability of the iPhone, I like my iPod and I’m still asking Michael Seifert(our CEO) if I can get the first Sitecore Macbook Air ;). Enough commercials. I’m a fanatic Microsoft user. Most likely you are as well. Sometimes I like it, although I’ve got my doubt about usability and release management. We’ve seen enough of that with the .NET 3.5 SP1 release.

But why for god’s sake, can’t Apple manage it to make iTunes a usable application on Windows? It’s crazy. A company so much focused on usability creates a slow unusable application with a huge memory footprint. Porting your application settings from your previous installation to a new one is a hell. And than the installer. Everyone who has to install Quicktime, iTunes or Safari is used to it:

apple update

My god, 77.25 MB’s? And now only 31.80 MB? I lost clue. Even more annoying: A while ago I decided not to install Safari. Wrong, total mistake. You get triggered all the time(sometimes on a daily base) if you want to install this browser. NO!! Ask me only once, don’t be Googlish(you know with their ugly toolbar in every open source installation).
Finally after the installation above, I received the following message:

apple restart

So, Apple, who’s always critical about Windows, can’t even create an installer which doesn’t have to restart? Although I have to give them one credit… my iPod survived a trip in the washing machine :). Sorry for my dirt, but it seems like commercial companies of this size can’t score a positive figures on all sides. And, that’s even worst, this is nothing new, they don’t seem to care, otherwise it was fixed long ago.

Updated: thank you commenter for updating my spelling, I always welcome people to let me learn from my mistake. Unfortunately my commenter is the kind of person who accesses a public computer and doesn’t use his real email. So I’m unable to thank him. Sorry!

64-bit server but still running on Sitecore 5.3

There seem to be a couple of issues with some libraries referenced in 5.3 when you run those libraries on an 64-bit environment. A while ago I heard about a trick which would allow you to run IIS in 32-bit mode, even when the OS is running on 64-bits. Today a partner called me with the exact same question. So I’ve redirected this person to the knowledge base from Microsoft: How to switch between the 32-bit versions of ASP.NET 1.1 and the 64-bit version of ASP.NET 2.0 on a 64-bit version of Windows

I haven’t found any time to test it. So all experiences are welcome!

Update: The partner just contacted me and told me it’s working. Of course both them and we don’t recommend such a solution. But in some cases you simply have no choice. Thanks for sharing.


I received a comment on my blog yesterday from Chris Corcino. Chris pointed out that he has a hard time to get started with TDD and BDD with Sitecore. Basically it’s nearly impossible to emulate the ASP.NET HttpContext. And this makes it impossible to do some additional mocking. As Sitecore is really designed around the HttpContext, it’s not so easy to create you own IServiceProvider implementation. Actually Microsoft confirms this problems otherwise they wouldn’t have to bring the MVC model as a replacement for the Control model.
I’m not sure if I satisfy you completely with one of the following answers, but these 2 options might be valuable for you to do at least soem testing:

  1. Internally we use a mix of tools to do some intensive testing of for example our Security Model. I know the R&D team uses a trick to emulate the HttpContext: start it regular using the Web tester built-into Visual Studio Team System – Test Edition. Then you can run your tests from Visual Studio.
  2. Another option would be to use the DomainObjects module created by Mark Cassidy. This allows you to create a Domain layer. As this layer is basically the one you want to test, you might be able to replace the ‘Sitecore connectors’ of the module with some mock objects.

Hopefully this helped. Feel free to submit your comments.