我用FiddlerCore:http://fiddler2.com/fiddlercore
private void button_click()
{
Thread myThread = new Thread(delegate()
{
fiddlerRun();
});
myThread.Start();
}
private void fiddlerRun()
{
#region AttachEventListeners
Fiddler.FiddlerApplication.BeforeResponse += delegate(Fiddler.Session oS)
{
String s1 = oS.GetResponseBodyAsString(); // this is where response is catched
//I know that response must contain specific word - if it is there- catch it!
if (s1.Contains("License"))
{
//do my stuff with response
//...
//stop Fiddler
Fiddler.FiddlerApplication.Shutdown();
System.Threading.Thread.Sleep(750);
}
};
#endregion AttachEventListeners
System.Diagnostics.Debug.WriteLine("Starting FiddlerCore...");
Fiddler.CONFIG.IgnoreServerCertErrors = false;
try
{
Fiddler.FiddlerApplication.Startup(8877, true, true);
}
catch { }
}
看看FiddlerCore http://fiddler2.com/fiddlercore – volody