Request To Code & FiddlerCore

You can use both the FiddlerCoreRequestToCode.dll and the FiddlerCore library in your project to automatically generate code and do whatever you want with it. For instance, you could write a code file for each session you observe. For example:

- Reference FiddlerCoreRequestToCode.dll
- Reference FiddlerCore -

using System.IO;
using System.Net;
using Fiddler;
using FiddlerCoreRequestToCode;
private void RecordCodeForUrl()
	//Start Fiddler on an available port
	FiddlerApplication.Startup(6575, FiddlerCoreStartupFlags.Default);

	var codeGenerator = new CodeGenerator(new CSharpLanguage()) { 
                                                         ShowUsage = true,
                                                         ShowComments = true };

	//For each request...
	FiddlerApplication.BeforeRequest += (session) =>
		string code;
		if (codeGenerator.TryGenerateCode(new[] { session }, out code))
			//You'll need to make the file path unique
			File.WriteAllText(Environment.CurrentDirectory + "/" + "request.cs", code);

	//You'll probably have another way of creating the traffic to be recorded.
	//This is just an example.
	var request = WebRequest.Create("");
	var response = request.GetResponse();
	using (var reader = new StreamReader(response.GetResponseStream()))
		string html = reader.ReadToEnd();

	//Stop Fiddler.


  1. Hi, Chad. Amazing tool ,very useful! Just one question, could I call FiddlerCoreRequestToCode.dll via python so that I can capture http(s) stream ?Thanks

  2. sreekanth yarlagadda

    Amazing tool…. Great work, Chad.

    Truly appreciate it.

  3. Hey Chad,
    Love your product…
    Quick question: Can “Request To Code” produce a code snippit that also Transforms the HTTP response for a web site that uses GZIP encoding?
    I am downloading a page that uses Java and encrypts the response using GZIP. Fiddler allows me to see the response by simply transforming the response using the Transformer tab settings. But now I want to get some VB code that allows me to do this in my VB application. Need to transform it first and was hoping that was a feature in “Request to Code”…

    Once I do that, I want to be able to take a table response and parse it out into an array. Would you have some VB code that does that as well? PLMK. Thanks in advance!!! – DLT

    • Hi David. Make sure check the “Read Response” option. That will add another function that will account for GZIP and Deflate encoding and return you the string contents of the response. At that point, you can use the ‘responseText’ variable and parse it however you need to into your array. Hope that helps. Thanks, ~Chad

  4. Hi, Chad! I’m surprised that this works and I’d love to learn more. Isn’t your extension loading its types from Fiddler.exe? Doesn’t that cause problems when using Session objects from FiddlerCore, where the types are defined in FiddlerCore.dll?

    If you found some way to workaround that limitation, I’d *love* to hear about how, since I could use it in many places.


    • Hi Eric! Nope, there’s no magic going on here. When you download the extension, you get a version of the extension for Fiddler and a version for FiddlerCore. This page is about the version that’s built against FiddlerCore. They do share the same code though, sans the UI code which is only in the Fiddler version, of course! The only downside is that I lose some namespace flexibility as a result of the way I have the projects setup, but it doesn’t actually impact functionality. Thanks! ~Chad

Leave a Reply

Your email address will not be published. Required fields are marked *