问题描述
我正在使用 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 等标头。