Christophe Gijbels edited this page Jan 8, 2015 · 22 revisions

When Glimpse is installed from NuGet, it is configured with settings that work for most web apps. You can easily make changes to the configuration to meet your requirements.

At its 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 adds a custom <section> in the <configSections>, named glimpse, in the web.config file.

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

HTTP module and HTTP handler

Glimpse adds a custom HTTP module and HTTP handler with ASP.NET.

Under <system.webServer>, for in IIS 7 and higher:

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

Under <system.web>, for in IIS 6 and lower:

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

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">
			<add type="{Namespace.Type, AssemblyName}"/>

The default Glimpse tabs are:

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

The following markup disables several tabs:

<glimpse defaultRuntimePolicy="On" endpointBaseUri="~/Glimpse.axd">
        <add type="Glimpse.AspNet.Tab.Configuration, Glimpse.AspNet"/>
        <add type="Glimpse.Core.Tab.Timeline, Glimpse.Core"/>
        <add type="Glimpse.Core.Tab.Trace, Glimpse.Core"/>
        <add type="Glimpse.AspNet.Tab.Environment, Glimpse.AspNet"/>
        <add type="Glimpse.AspNet.Tab.Request, Glimpse.AspNet"/>

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 (for example on Azure), disable the LocalPolicy:

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

Security warning: When the markup above is used and local policy is ignored, every request can display Glimpse data. Production apps should limit who can view Glimpse data. See

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">
			<add type="Glimpse.Core.Policy.ControlCookiePolicy, Glimpse.Core"/>

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 writing 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">
		<add contentType="application/xml"/>
		<!-- <clear/> -->

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">
		<add statusCode="404"/>

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">
		<add regex=".*/admin.*"/>

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" />

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.

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.