Overview

We've added support for the Http Module. This allows you to leverage your current investment in this, but leverage the power and flexibility that comes with the ReflectInsight viewer. You can view your Http messages in realtime, in a rich viewer that allows you to filter out and search for what really matters to you.

Http Module Configuration

1. Download and install the ReflectInsight Viewer. You will need this installed to view your messages from the ReflectInsight Logging Extensions.

Download

2. Download the ReflectInsight Extension Binaries or Source and rebuild if necessary. Alternatively you can use the NuGet package. See below for details on the NuGet package.

NOTE: If you have added the Log4net Extension from the NuGet gallery, then you can skip step #3 as it's already done for you.

3. Once you have the ReflectInsight Extensions, go to your project in Visual Studio and add a reference to:
  • ReflectSoftware.Insight.dll
  • ReflectSoftware.Insight.Extensions.HttpModule
Adding_Assemblies.png

4. The next step is to configure your web configuration file and incorporate the ReflectInsight appender. If you don't already have a Web.config, add it. Then open the configuration file and add a new ConfigSection as shown here:

<configuration>
  <configSections>
    <section name="insightSettings" type="ReflectSoftware.Insight.ConfigurationHandler, ReflectSoftware.Insight"/>    
  </configSections> 
</configuration>
5. Now you will need to add the InsightSettings section. You can get started with the following simple configuration:

<configuration>
  <insightSettings>
    <baseSettings>
      <configChange enabled="true"/>
      <propagateException enabled="false"/>
      <exceptionEventTracker time="20"/>
      <senderName name="TestWebApp"/>
      <debugMessageProcess enabled="true" />
    </baseSettings>

    <httpModule>
      <properties name="myDebugHttpProperties">
        <userEnterEnterMethod value="true"/>
        <ignoreUrlsParts>
          <!-- will ignore urls that have any part of its path with any key words listed below -->
          <part name="/somepagetoignore.aspx"/>
          <part name="/someotherpagetoignore"/>
          <part name=".htm"/>
          <part name=".html"/>
          <part name=".css"/>
          <part name=".js"/>
          <part name=".gif"/>
          <part name=".png"/>
          <part name=".jpg"/>
          <part name=".bmp"/>
          <part name=".ico"/>
          <part name=".swf"/>
        </ignoreUrlsParts>
        <ignoreUsername value="false"/>
        <ignoreHeader all="false">
          <!-- will ignore these header values -->
          <parameter name="Connection"/>
          <parameter name="Host"/>
        </ignoreHeader>
        <ignoreQueryString all="false">
          <!-- will ignore these query string parameters -->
          <parameter name="name"/>
          <parameter name="location"/>
        </ignoreQueryString>
        <ignoreFormElements all="false">
          <!-- will ignore these form elements -->
          <element name="__VIEWSTATE"/>
          <element name="__EVENTVALIDATION"/>
          <element name="Password"/>
        </ignoreFormElements>
        <ignoreCookies all="false">
          <!-- will ignore these cookie names -->
          <cookie name="ASP.NET_SessionId"/>
        </ignoreCookies>
      </properties>
    </httpModule>   
    
    <listenerGroups active="Debug">
      <group name="Debug" enabled="true" maskIdentities="false">
        <destinations>
          <destination name="Viewer" enabled="true" filter="" details="Viewer"/>
        </destinations>
      </group>
    </listenerGroups>

    <logManager>
      <instance name="httpModule" category="HttpModule"/>
    </logManager>
    
    <extensions>
      <extension name="riHttpModule" instance="httpModule" properties="myDebugHttpProperties" enabled="true"/>
    </extensions>
  </insightSettings>
</configuration>
NOTE: Notice that this InsightSetting configuration includes additional details for the HttpModule. You will need to make sure you have this included

6. Now you need to configure your Web configuration with a reference to the System.Web and System.WebServer sections. You need to add the following sections:

<configuration>
  <system.web>
    <!-- used for application pools that support ASP.NET classic mode -->
    <!--
    <httpModules>
      <add name="RIHttpModule" type="ReflectSoftware.Insight.Extensions.HttpModule.RIHttpModule, ReflectSoftware.Insight.Extensions.HttpModule" />
    </httpModules>        
    -->
  </system.web>
  
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true">      
      <!-- used for application pools that support ASP.NET integrated/pipeline mode -->
      <add name="RIHttpModule" type="ReflectSoftware.Insight.Extensions.HttpModule.RIHttpModule, ReflectSoftware.Insight.Extensions.HttpModule"/>      
    </modules>
  </system.webServer>
</configuration>
7. Alternatively you can look at the configuration files that are part of the sample application.

8. That's it, you're done!

NuGet Package

We've created a NuGet package for our Http Module extension. You can find it over on Nuget.

To install ReflectSoftware.Insight.Extensions.HttpModule extension, run the following command in the Package Manager Console.

sshot-324.png

Last edited Jul 22, 2013 at 4:09 AM by RSDeveloper, version 32