c# - C# WebClient.DownloadString 不返回整个网页源
问题描述
我WebClient.DownloadString
用来获取网页的 Html 源代码,但我得到的回报是:
<html style="height:100%">
<head>
<META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">
<meta name="format-detection" content="telephone=no">
<meta name="viewport" content="initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
</head>
<body style="margin:0px;height:100%">
<iframe id="main-iframe"
src="/_Incapsula_Resource?CWUDNSAI=41&xinfo=9-19309783-0%20NNNY%20RT%281614802895891%2028%29%20q%280%20-1%20-1%20-1%29%20r%280%20-1%29%20B10%2814%2c0%2c0%29%20U18&incident_id=1309000160050658955-81390253115245577&edet=10&cinfo=0e000000b6ef&rpinfo=0"
frameborder=0 width="100%" height="100%" marginheight="0px" marginwidth="0px">
Request unsuccessful. Incapsula incident ID: 1309000160050658955-81390253115245577
</iframe>
</body>
</html>
但是缺少页面的实际内容。我做错了什么?
解决方案
您的 HTTP 请求不满足服务器的要求,因此 Incapsula 已将您标记为可疑用户。您发布的回复确实包含完整的网络回复文本。我会考虑确保您在请求中提供了足够的信息。
要检查以添加到您的 HTTP 请求的一些内容是用户代理、cookie 等标头。
推荐阅读
- python - 在创建列表和创建列表之后应用扩展和追加方法有什么区别
- python - 理解可变数量的参数?
- c++ - 我可以更好地找到给定值在二叉搜索树中的位置吗?
- css - CSS ::添加环形后
- javascript - 在嵌套对象中搜索“键”并显示其值 Javascript
- flutter - 可以将哈希码与 <= => 符号进行比较吗?
- python - “pip install selenium”不起作用 // 使用 python 3 // windows 10
- c# - 控制台模板应用程序 MediaCapture 无法录制视频
- c# - 如何配置 appsettings 日志记录部分以使用过滤器定义提供程序?
- flutter - 可拖动小部件不会改变其位置