Craftsman at work

I'm Artur Karbone, coding software architect and independent IT consultant and this is my blog about craftsmanship, architecture, distributive systems, management and much more.

Sitefinity and Web API gotcha

Today I needed to expose some REST functionality in the project, which leverages Sitefinity, via ASP.NET Web API.

Standard routing setup didn't work out for me. There is a little gotcha. You have to register routing after Sitefinity bootstraper is initialized:

 Bootstrapper.Initialized += new EventHandler<Telerik.Sitefinity.Data.ExecutedEventArgs>(this.AfterInit);
 private void AfterInit(object sender, ExecutedEventArgs args)
 {       
    if (args.CommandName == "Bootstrapped")
    {
       WebApiConfig.Register(GlobalConfiguration.Configuration); 
    }
 }
comments powered by Disqus