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