Welcome to the Glimpse Documentation! Here we hope to introduce you to the various tutorials, concepts and APIs you might need when discovering and using Glimpse.

NOTE: Glimpse docs are currently being improved. If you'd like to help out, just edit this page or contribute to our GitHub Wiki

Custom Runtime Policies

Runtime policies are what dictate how Glimpse responds to any given HTTP request is controlled via a collection of IRuntimePolicy implementations.

Default Runtime Policy

The Glimpse and Glimpse.AspNet packages ship with several runtime policies (source available on GitHub) that define the common behavior of Glimpse:

  • AjaxPolicy - Ajax Policy disables Glimpse from changing to the response body for AJAX requests
  • LocalPolicy - Local Policy forces Glimpse to ignore requests from remote clients
  • ContentTypePolicy - Content Types filter what specific Content Types Glimpse will be enabled for
  • UriPolicy - Blacklist URIs filter Glimpse to only work on URIs that match specifc regex
  • StatusCodePolicy - Status Codes filter what specific Status Codes Glimpse will be enabled for

Policies can be configured in web.config.

Simple Runtime Policy

The Glimpse.AspNet NuGet package adds a stub IRuntimePolicy implementation to a user's web application. The stub file, once uncommented, looks like this:

using Glimpse.AspNet.Extensions;
using Glimpse.Core.Extensibility;

namespace Users.Web.Application.Namespace
    public class GlimpseSecurityPolicy:IRuntimePolicy
        public RuntimePolicy Execute(IRuntimePolicyContext policyContext)
            var httpContext = policyContext.GetHttpContext();

            if (!httpContext.User.IsInRole("Administrator"))
                return RuntimePolicy.Off;

            return RuntimePolicy.On;

        public RuntimeEvent ExecuteOn
            get { return RuntimeEvent.EndRequest; }

The stub shows an example of a policy that only allows Glimpse to run for users in the "Administrator" role. Role based security, as well as IP address and user agents, are common criteria for custom policy.

Glimpse allows for several runtime policies to be configured at any given time, but will only operate under the lowest policy returned by the collection.

More Examples

Here are some more examples of whats possible with creating different policies,