2
团队,提琴手没有捕获LINQPad上webClient的本地流量
我有以下LINQPad的简单WebClient调用。我怎么尝试Fiddler只是拒绝捕捉。 我只是没有办法。我尝试了localhost,localhost(带点),localhost.fiddler和我的机器名,而不是127.0.0.1。提琴手根本没有兴趣去捕捉这一切。任何人都有任何想法。
void Main()
{
CookieWebClient client = new CookieWebClient()
{
Proxy = new WebProxy("127.0.0.1", 8888) // Fiddler
};
Console.WriteLine(client.DownloadString(url)); // Cookie is created here
Console.WriteLine(client.DownloadString(url)); // In this request, the cookie gets sent back to the web API
Console.WriteLine("Done");
}
// Define other methods and classes here
public class CookieWebClient : WebClient
{
private CookieContainer jar = new CookieContainer();
protected override WebRequest GetWebRequest(Uri address)
{
WebRequest request = base.GetWebRequest(address);
HttpWebRequest webRequest = request as HttpWebRequest;
if (webRequest != null)
webRequest.CookieContainer = jar;
return request;
}
}
string url = "http://localhost:21531/api/employees/12345";
嗨埃里克,你的建议改变字符串的URL做窍门。以下终于奏效。 string url =“http://localhost.fiddler:21531/api/employees/12345”;一个多小时我只操作Proxy = new WebProxy(“127.0.0.1”,8888);我提到了不同的组合。非常感谢。 – VivekDev 2014-10-04 03:49:16
我正在使用LinqPad与HttpClient。我有:'var webAddr =“http://localhost.fiddler:53733 /”;但Fiddler仍然没有看到任何东西。 – 2016-08-23 18:07:47
@MKenyonII - 查看上面的答案。如果请求失败,则表示您的代理没有正确配置。 – EricLaw 2016-08-25 14:53:53