Capture HTTP/S Traffic with FiddlerCore
This article explains how to capture HTTP/S traffic with FiddlerCore
Once FiddlerCore is configured, it starts to listen for a traffic on the background. When it captures any session, it notifies you by raising the following events:
The following event handlers are invoked on session-handling background threads.
If you need to update a UI thread (e.g. in WPF or Windows Forms application), you may need to delegate the update logic back to the UI thread, for example by using Dispatcher.BeginInvoke (WPF) or Control.Invoke (Windows Forms).
Also, if you use collections that are not thread-safe, like
List<T>
, you may need to employ additional synchronization mechanisms.
FiddlerApplication.BeforeRequest
You should use this event to act when client request is received. For example, you can modify the session flags to use specific ssl protocols.
FiddlerApplication.BeforeRequest += session =>
{
session["x-OverrideSslProtocols"] = "ssl3;tls1.0;tls1.1;tls1.2";
};
FiddlerApplication.BeforeResponse
You should use this event to act when a server response is received. For example, you can decode the body.
FiddlerApplication.BeforeResponse += session =>
{
session.utilDecodeResponse();
};
FiddlerApplication.AfterSessionComplete
You should use this event to act when a session is completed. For example, notify the user.
FiddlerApplication.AfterSessionComplete += session =>
{
Console.WriteLine($"Finished session: {session.fullUrl}");
}
These are only the most commonly used handlers. For the full list of events check FiddlerApplication's API reference.