Community
Documentation
Extensions
Support

Documentation

find out more
Community
Documentation
Extensions
Support
NOTE: Glimpse documentation is currently being improved. If you'd like to help the effort, please edit this page or contribute to our GitHub Wiki

Configuration

Glimpse is configured with a custom section called <glimpse> in a web applications web.config file. Installation via NuGet will automatically update web.config to the minimal configuration.

Minimal Configuration

The minimal configuration for Glimpse registers a HTTP Handler and HTTP Module, as well as a custom configuration section, used for further configuration.

Custom Section

A custom <section>, named glimpse is required in web.config for Glimpse to work.

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

HTTP Module & HTTP Handler

In addition to the custom <section>, Glimpse also requires a custom HTTP Module and HTTP Handler be registered with ASP.NET. The module and handler may be registered in the <system.web> section (for older versions of IIS) or <system.webServer> or both.

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>

Additional Configuration

In addition to the minimal configuration, Glimpse can optionally have its behavior modified in various ways.

Tab Management

Individual Glimpse tabs can be disabled by instructing Glimpse to ignore their types:

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

Common Glimpse tabs include:

Policy Management

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

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. Values of On and Off are provided for easy configuration, but there any many values that can be set:

  • Off: Does not allows 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>

Logging

An internal Glimpse diagnostics log can be enabled to help troubleshoot problems with Glimpse.

<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 can be used to set the location of the written log file. logLocation defaults to Glimpse.log in the web applications root directory.