Setting Up Glimpse on an ASP.NET Web Site

Glimpse is a real-time web diagnostics package for ASP.NET web sites.  Per the Glimpse web site, it “inspects web requests as they happen, providing insights and tooling that reduce debugging time and empower every developer to improve their web applications”.

Thanks to NuGet, it is very easy to quickly install and configure Glimpse.  In most cases, though, you will want to restrict who has access to Glimpse.  To do that, the installation requires just a bit more work.

Some useful documentation about the process can be found at the following links:

Here is a very brief summary of the steps to take to add Glimpse to a web site and restrict who has access to it.  Please refer to the documentation at the preceding links for more information.

1) Use NuGet to add the Glimpse packages to the project.
2) Start the web site and verify that you can access glimpse.axd
3) Edit the GlimpseSecurityPolicy.cs file to add authorization code to specify who can access glimpse.axd.  The exact code needed will vary from site-to-site.  The default example given in the comments of the basic GlimpseSecurityPolicy.cs file is shown here.

public RuntimePolicy Execute(IRuntimePolicyContext policyContext)
    var httpContext = policyContext.GetHttpContext();
if (!httpContext.User.IsInRole("Administrator"))
        return RuntimePolicy.Off;
    return RuntimePolicy.On;

4) Add the following to the web.config file to allow Glimpse to be accessed from remote computers (otherwise it can only be access from the local webserver).  This should only be done if Step 3 was also done.

<glimpse defaultRuntimePolicy="On" endpointBaseUri="~/Glimpse.axd">
          For more information on how to configure Glimpse, please visit
          or access {your site}/Glimpse.axd for even more details and a Configuration Tool to support you.
        <add type="Glimpse.AspNet.Policy.LocalPolicy, Glimpse.AspNet"/>

5) Start the web site and verify that you can now only access glimpse.axd if you are authorized to do so.

That’s it.  Glimpse should now be installed and ready for use, but only by authorized users.

One Response to Setting Up Glimpse on an ASP.NET Web Site

  1. Pingback: cv writers in sri lanka

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: