While I have my gripes about the implementation of Sitecore.Context as essentially a repository for global variables, there is no doubt that the concept provides a great deal of the flexibility of the platform. But this flexibility can also create headaches in debugging. Context item, database, language, device... and further how they're used to construct and apply renderings. There's a lot going on in constructing just a single page. How can we securely expose information about the context to help debug published pages, even in production?
Glimpse is a debugging tool which espouses that "what Firebug is for the client, Glimpse does for the server." It securely and transparently adds a client-side debugging interface to your output pages.
Out of the box, Glimpse provides all kinds of information on what's going on with the server side of your ASP.NET Webforms or MVC application. What if we could extend this UI to include information about the Sitecore Context and other page information? The Glimpse site already provides a lot of great information on what Glimpse does and how to install Glimpse. It also provides a nice tutorial on its dead-simple plugin architecture.
To create a Sitecore plugin for Glimpse:
- Install Glimpse using NuGet.
- Create a new class library in your solution.
- Reference Glimpse.Core, System.ComponentModel.Composition, and System.Web assemblies
- Create a new class that implements IGlimpsePlugin
- Mark your class with the attribute [Glimpse.Core.Extensibility.GlimpsePluginAttribute()]
- Implement the GetData method to return a List of object arrays containing your debugging data
- Implement the Name property to return the string "Sitecore"
- Drop your new assembly into your Glimpse-enabled application
The result may look something like this:
UPDATE: In April 2012 there was a Sitecore User's Virtual Group meeting in which David Morrison from Sitecore showed off his more advanced Sitecore Glimpse plugin.