How to capture ASP.NET web service traffic using Fiddler

  • Description

    Sometimes, for troubleshooting purposes it is necessary to use HTTP debugging proxies to capture and investigate HTTP traffic of your website.

    A good example of such a proxy is Fiddler. For more information about Fiddler visit the following page:
    http://www.telerik.com/fiddler

    When it is running, Fiddler changes proxy server settings for the currently logged in Windows user to allow capturing traffic from web browsers or other applications. Specifically, it changes the system's proxy settings to the 127.0.0.1:8888 address.

    However, this does not affect applications such ASP.NET sites, because they use different user accounts and their own proxy settings.

    This article describes how to configure an ASP.NET web site to use Fiddler as a proxy, and allow Fiddler to capture web service calls between the ASP.NET web site and the web services that the site is using.

  • To configure the Fiddler tool to capture web service calls from an ASP.NET web site, you need to perform the following actions on your solution:

    1. In the Global.asax file, implement the following Application_Start method:
      <script runat="server">
          public void Application_Start()
          {
              ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback(delegate { return true; });
          }
      </script>
    2. In the Global.asax file, add the following import statements:
      <%@ Import Namespace="System.Net" %>
      <%@ Import Namespace="System.Net.Security" %>
    3. In the web.config file, configure the following XML under the <configuration> section:
      <system.net>
        <defaultProxy useDefaultCredentials="true" enabled="true">
          <proxy usesystemdefault="false" proxyaddress="http://127.0.0.1:8888" bypassonlocal="false" autoDetect="false"/>
        </defaultProxy>
      </system.net>
    4. If using Sitecore Publishing Service, in Sitecore.Publishing.Service.config file, configure the following XML under the /configuration/sitecore/publishing.service section:
      <jsonHttpClient type="Sitecore.Framework.Publishing.Client.Http.JsonClient, Sitecore.Framework.Publishing.Client.Http" singleInstance="true">
        <!-- The location of the proxy to send requests through. -->
        <param name="proxyAddress">http://localhost:8888</param>
        <!-- Turn on/off the proxy capability.-->
        <param name="proxyEnabled">true</param>
      </jsonHttpClient>
    5. Enable Fiddler to capture the HTTPS traffic.

    After the traffic is captured by Fiddler, it can be saved for further sharing and analysis.

Applies to:

EXM 1.0+, App Center 1+, CMS 6+

October 08, 2014
December 06, 2018

Keywords: 

  • App Center,
  • CMS,
  • ECM