Hi,
I need a traffic to be intercepted with FiddlerCore and then passed to Fiddler (like in a chain, no matter which is first, FiddlerCore or fiddler)
What shoul i set in FiddlerCoreStartupFlags or anywhere else to have it working?
Thanks you
3 Answers, 1 is accepted
Hi Ihor,
Instead of using RegisterAsSystemProxy method use the ChainToUpstreamGateway method. This will chain FiddlerCore to the System Settings set by Fiddler desktop. Let me provide more details and references below.
Example
First, ensure Fiddler desktop is running with the default settings, like Port 8888 and Register As System Proxy.
Then use the following FiddlerCore configuration to capture traffic and forward it to the upstream proxy settings.
static void Main(string[] args)
{
// Attach to events of interest:
FiddlerApplication.AfterSessionComplete += session => Console.WriteLine(session.fullUrl);
// Build startup settings:
var settings = new FiddlerCoreStartupSettingsBuilder()
.ListenOnPort(8865)
.ChainToUpstreamGateway()
.Build();
// Start:
FiddlerApplication.Startup(settings);
Console.ReadLine();
// Shutdown:
FiddlerApplication.Shutdown();
}
After navigating to the FiddlerCore port, localhost:8865, in the browser, the following output is displayed in Fiddler and FiddlerCore.
For additional reference, see the FiddlerCore Configuration documentation.
Please let me know if you need any additional information. Thank you for building with FiddlerCore.
Regards,
Eric R | Senior Technical Support Engineer
Progress Telerik
Our thoughts here at Progress are with those affected by the outbreak.
Thank you for your reply, Eric
The example is working perfect, but seems i stated problem in a wrong way:
I have a built-in browser in my WinForm application
I need FiddlerCore to make its work (it does perfectly)
and also to pass the sessions to the Fiddler (to log and monitor sessions, as there are many sessions and the Fiddler is a perfect tool to visualize them in real-time)
With the code below the applications intercepts its traffic. Unfortunatelly is not possible to specify a port, because soft works with 3rd-party websites. IS there any other way than collection and saving sessions into a "saz" archive? Thank you
FiddlerApplication.Startup(0, FiddlerCoreStartupFlags.Default & ~FiddlerCoreStartupFlags.RegisterAsSystemProxy);
Fiddler.URLMonInterop.SetProxyInProcess("127.0.0.1:" + FiddlerApplication.oProxy.ListenPort.ToString(), "<-loopback>");
Hi Ihor,
If I understand correctly, you would like to use a different export API. In this case, a custom SAZ Provider could be used. Something like this may be possible by creating a custom implementation of the ISAZProvider.
With this method, sessions would still be exported using the Utilities.WriteSessionArchive utility method as shown in the below code snippet.
bool success = Utilities.WriteSessionArchive(filename, sessions.ToArray(), password, false);
If there are too many sessions, it might help to filter on specific session properties in the BeforeResponse event. See the FiddlerApplication API reference and the Modifying a Request or Response documentation for more details.
Ultimately, this is highly dependent on the browser implementation and if the port cannot be set, it may not be possible also.
Please let me know if you need any additional information. Thank you.
Regards,
Eric R | Senior Technical Support Engineer
Progress Telerik
Our thoughts here at Progress are with those affected by the outbreak.