简体   繁体   English

HttpClient GetAsync响应内容与Fiddler给我的内容不同

[英]HttpClient GetAsync response content is different from what Fiddler is giving me

I'm running a GET request using HttpClient.GetAsync . 我正在使用HttpClient.GetAsync运行GET请求。

I am then using Fiddler to capture this request and see what it throws back: 然后,我正在使用Fiddler捕获此请求并查看其返回的内容:

    var response = await http.GetAsync("http://app.creditsafeuk.com/CSUKLive/webpages/CompanySearch/SearchResults.aspx?SelectedCountry=UK");
    response.EnsureSuccessStatusCode();
    var html = await response.Content.ReadAsStringAsync();

This request is sent in my C# app and then captured with fiddler. 该请求在我的C#应用​​中发送,然后被提琴手捕获。

Even though it is the exact same request, the html in the response is different. 即使是完全相同的请求,响应中的html也不同。

Here is the HTML I'm getting from Fiddler 这是我从Fiddler获得的HTML

And this is the HTML that is being returned with the HttpClient 这是HttpClient返回的HTML

Any help would be much appreciated, I just can't seem to figure out why I would get two separate versions even though Fiddler is capturing the same request my program is sending. 任何帮助将不胜感激,即使Fiddler捕获程序发送的相同请求,我似乎也无法弄清楚为什么我会得到两个单独的版本。

I found out what it was. 我发现了那是什么。

Turns out, during debugging, the text visualiser actually cuts off parts of the string if it's too long. 事实证明,在调试过程中,文本可视化工具实际上会截断字符串的一部分(如果字符串太长)。 So, what I need is actually there, but the Text Visualiser wasn't giving it to me when I copied and pasted. 所以,实际上我需要的是它,但是当我复制粘贴时,Text Visualiser并没有给我。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 没有从 MVC 应用程序中 HttpClient 的 GetAsync API 得到响应 - Didn't get response from GetAsync API of HttpClient in MVC applications 在不同线程中运行 HttpClient GetAsync - Run HttpClient GetAsync in different threads httpclient GetAsync 不适用于大内容 - httpclient GetAsync doesn't work for large content 从 HttpClient.GetAsync() 捕获 OutOfMemory 异常 - Catching OutOfMemory Exceptions from HttpClient.GetAsync() FromQuery从HttpClient GetAsync接收null arguments - FromQuery receiving null arguments from HttpClient GetAsync 不带Fiddler(Http / Https调试器)的第二次GetAsync尝试,带有ResponseHeadersRead的HttpClient失败(超时) - HttpClient with ResponseHeadersRead fails(timeouts) at 2nd GetAsync try without Fiddler(Http/Https debugger) 使用 HttpClient.GetAsync() 时如何确定 404 响应状态 - How to determine a 404 response status when using the HttpClient.GetAsync() C# HttpClient GetAsync 异常“服务器返回无效或无法识别的响应” - C# HttpClient GetAsync exception “The server returned an invalid or unrecognized response” HttpClient GetAsync 和 ReadAsStringAsync 需要反序列化复杂 JSON 响应的一部分 - HttpClient GetAsync and ReadAsStringAsync needed to deserialize just part of a complex JSON response 如果没有等待 HttpClient().GetAsync().Result.Content.ReadAsStringAsync().Result 有什么问题吗? - Any issue if no await on HttpClient().GetAsync().Result.Content.ReadAsStringAsync().Result?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM