Documentation

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

Configuration

When installing Glimpse via Nuget, all of this configuration is taken care of for you. So you only need to worry about the details, when you want to change something or take manual control.

At it's core, Glimpse is configured with a custom section called <glimpse> in your web application's web.config file. Installing using NuGet will automatically update web.config to the minimal configuration.

Configuration options:

Minimal configuration

Glimpse's minimal configuration adds a custom configuration section, and registers a HTTP module and HTTP handler.

Custom section

Glimpse needs a custom <section> in the <configSections>, named glimpse, in web.config.

<configuration>
    <configSections>
        <section name="glimpse" type="Glimpse.Core.Configuration.Section, Glimpse.Core" />
    </configSections>
</configuration>

HTTP module and HTTP handler

Glimpse needs a custom HTTP module and HTTP handler with ASP.NET, in the <system.web> section if you have IIS 6 or earlier, or in the <system.webServer> section for later versions of IIS.

For <system.web>:

<system.web>
    <httpModules>
        <add name="Glimpse" type="Glimpse.AspNet.HttpModule, Glimpse.AspNet"/>
    </httpModules>
    <httpHandlers>
        <add path="glimpse.axd" verb="GET" type="Glimpse.AspNet.HttpHandler, Glimpse.AspNet"/>
    </httpHandlers>
</system.web>

For <system.webServer>:

<system.webServer>
    <modules>
        <add name="Glimpse" type="Glimpse.AspNet.HttpModule, Glimpse.AspNet" preCondition="integratedMode"/>
    </modules>
    <handlers>
        <add name="Glimpse" path="glimpse.axd" verb="GET" type="Glimpse.AspNet.HttpHandler, Glimpse.AspNet"  preCondition="integratedMode" />
    </handlers>
</system.webServer>

Changing the configuration

You can change Glimpse's behavior by:

  • changing which tabs are displayed
  • enabling, disabling and customizing security policies
  • changing the logging level

Configuring tabs

You can disable Glimpse tabs by instructing Glimpse to ignore their types:

<glimpse defaultRuntimePolicy="On" endpointBaseUri="~/Glimpse.axd">
    <tabs>
        <ignoredTypes>
            <add type="{Namespace.Type, AssemblyName}"/>
        </ignoredTypes>
    </tabs>
</glimpse>

The default Glimpse tabs are:

  • Diagnostics:
    • Timeline - Glimpse.Core.Tab.Timeline
    • Trace - Glimpse.Core.Tab.Trace
  • ASP.NET:
  • ASP.NET MVC:
  • ADO.NET:
    • SQL - Glimpse.ADO.Tab.SQL

You can't disable the Ajax or History tabs, because they're integral to Glimpse.

Configuring runtime policy

Policies control what Glimpse is allowed to do to any given request. Policies can be disabled and customized to simplify some scenarios.

For example, to run Glimpse on a remote server (like a server in Windows Azure), disable the LocalPolicy:

<glimpse defaultRuntimePolicy="On" endpointBaseUri="~/Glimpse.axd" >
    <runtimePolicies>
        <ignoredTypes>
            <add type="Glimpse.AspNet.Policy.LocalPolicy, Glimpse.AspNet"/>
        </ignoredTypes>
    </runtimePolicies>
</glimpse>

Similarly, the ControlCookiePolicy can be disabled to remove the need to turn Glimpse on and off in the browser:

<glimpse defaultRuntimePolicy="On" endpointBaseUri="~/Glimpse.axd">
    <runtimePolicies>
        <ignoredTypes>
            <add type="Glimpse.Core.Policy.ControlCookiePolicy, Glimpse.Core"/>
        </ignoredTypes>
    </runtimePolicies>
</glimpse>

Glimpse will never be allowed more permissions than the defaultRuntimePolicy allows. On and Off are the simplest configuration values, but there are many more options:

  • Off: Does not allow Glimpse to perform any operations or capture any data.
  • PersistResults: Allows Glimpse to only capture request metadata.
  • ModifyResponseHeaders: Allows Glimpse to write custom headers and set cookies on HTTP responses in addition to capturing and persisting results.
  • ModifyResponseBody: Allows Glimpse to write to a HTTP response body, in addition to modifying headers and to capture and persist results.
  • DisplayGlimpseClient: Allows Glimpse to write the Glimpse JavaScript client <script> tag to the HTTP response body, in addition to writting headers and to capture and persist results.
  • On: Allows Glimpse to run all above mentioned operations against an HTTP request/response.

In addition to the above policy configuration options, some policies allow for additional configuration:

Content Types that Glimpse will respond to can be added and removed with the <contentTypes> whitelist element.

<glimpse defaultRuntimePolicy="On" endpointBaseUri="~/Glimpse.axd">
    <runtimePolicies>
      <contentTypes>
        <add contentType="application/xml"/>
        <!-- <clear/> -->
      </contentTypes>
    </runtimePolicies>
</glimpse>

Status Codes are similar to content types in that the status codes that Glimpse will respond to can be added and removed with the <statusCodes> whitelist element.

<glimpse defaultRuntimePolicy="On" endpointBaseUri="~/Glimpse.axd">
    <runtimePolicies>
      <statusCodes>
        <add statusCode="404"/>
      </statusCodes>
    </runtimePolicies>
</glimpse>

URIs that Glimpse will respond to can be filtered with the <uris> blacklist element of regular expressions. This example disables Glimpse for all requests to /admin for the configured web application.

<glimpse defaultRuntimePolicy="On" endpointBaseUri="~/Glimpse.axd">
    <runtimePolicies>
      <uris>
        <add regex=".*/admin.*"/>
      </uris>
    </runtimePolicies>
</glimpse>

Configuring logging

If you're having problems with Glimpse, you can enable the internal Glimpse diagnostics log:

<glimpse defaultRuntimePolicy="On" endpointBaseUri="~/Glimpse.axd">
    <logging level="Trace" />
</glimpse>

The level attribute can be set to Trace, Debug, Info, Warn, Error or Fatal. The default value is Off.

The <logging> element has an additional attribute called logLocation which sets the location of the log file. By default, logLocation is Glimpse.log in your web application's root directory.