简体   繁体   English

C#使用禁用的JavaScript发送Web请求

[英]C# Send web request with disabled javascript

I want to download content of one website programatically and it looks like this content is loaded by ajax calls. 我想以编程方式下载一个网站的内容,并且看起来该内容是通过ajax调用加载的。 When I simply disable javascript in my browser, only 1 request is made by this page and all content is loaded without AJAX. 当我仅在浏览器中禁用javascript时,此页面仅发出1个请求,并且所有内容均不使用AJAX加载。

What I need to achieve is to make a web request which will tell web page that I have disabled javascript so it returns me all the content and not just empty body tag with no content at all. 我需要实现的是发出一个Web请求,该请求将告诉网页我已禁用javascript,因此它将返回我所有的内容,而不仅仅是返回没有内容的空body标记。

Any suggestions how to do that? 有什么建议怎么做?

You need to mimic browser. 您需要模仿浏览器。

Steps: 脚步:

  • Use Fiddler and see what is sent by browser. 使用Fiddler并查看浏览器发送的内容。
  • Set the same headers/cookies/user agent via C# code. 通过C#代码设置相同的标头/ cookie /用户代理。
  • If does not work - compare request your code makes with browser's one by using Fiddler as proxy for your C# code (set proxy to http://localhost:8888 ) 如果不起作用,请使用Fiddler作为C#代码的代理,将请求的代码与浏览器的代码进行比较(将代理设置为http://localhost:8888

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

相关问题 如何在C#Windows应用程序中的队列中发送Web请求 - How to send web request in queue in C# windows application 如何将发布请求从 Android 发送到 C# Web API - How to send post request from Android to a C# web API 使用rest客户端应用程序发送Web请求,但不使用c# - Send Web request working with rest client app, but not working with c# 如何在C#中使用发布Web请求发送.csv文件 - How to send .csv file with post Web Request in C# 在 c# 代码中获取 http web 请求发送错误 - Get http web request send error in c# code C#Web代理请求 - C# Web Proxy request 从 ASP.NET MVC 项目后面的 C# 代码向另一个 web 站点发送 JSON 请求 - Send a JSON request to another web site from C# code behind in an ASP.NET MVC project 如何配置C#Web服务客户端以并行发送HTTP请求标头和正文? - How do I configure a C# web service client to send HTTP request header and body in parallel? 如何在C#下向Web服务器发送执行JS功能的请求? - How to send to a web-server request for performing js-function under c#? 如何在没有来自C#控制台应用程序数据的情况下向Web服务发送POST请求? - How to send a POST Request to a web service without data from console application in C#?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM