WebClient.Downloadstring 不适用于参数 link
WebClient.Downloadstring not work with parameters link
我尝试用System.Net.WebClient.downloadstring方法下载网页源码
地址是这样的:“http://www.example.com/aaa/?only=true”
当我尝试将此地址下载到字符串时,我只看到 google 网站源代码
下载的字符串如下:"Google(function(){window.google={kEI:'J_THVK_NHMLwUIGlgJAC',kEXPI:'4"
等...
这是我的代码:
Dim webClient As System.Net.WebClient = New System.Net.WebClient()
If bEncode = True Then
webClient.Encoding = System.Text.Encoding.UTF8
End If
Dim strResult As String = webClient.DownloadString("http://www.example.com/aaa/?only=true")
但是在网络浏览器中,我看到正常 html 当我点击查看源代码时,它是正常的。
为什么我无法将页面源下载到我的字符串中?为什么要下载 google 字符串?
非常感谢。
添加的注释:
** 很抱歉我的英语不好。
我可以通过 HttpClient
获取 html 页面
HttpClient client = new HttpClient();
var html = await client.GetStringAsync("http://www.betbrain.com/football/brazil/cearense-1/horizonte-v-sao-benedito-ce/1x2/full-time-excluding-overtime/?only=true&attempt=1");
开头为
<div id="oddsDetailRTFDisabled" class="hidden">
<div class="FormMessage FormError">
<span class="FormIcon">MESSAGES:</span>
<h2 class="FormTitle">Real time updates disabled</h2>
<p class="FormP">The automatic updates don't work if there are more than four Odds pages (tabs) opened with the same browser. If this is not the case try clearing your browser's cache (temporary internet files).</p>
</div>
</div>
......
我尝试用System.Net.WebClient.downloadstring方法下载网页源码
地址是这样的:“http://www.example.com/aaa/?only=true” 当我尝试将此地址下载到字符串时,我只看到 google 网站源代码
下载的字符串如下:"Google(function(){window.google={kEI:'J_THVK_NHMLwUIGlgJAC',kEXPI:'4" 等...
这是我的代码:
Dim webClient As System.Net.WebClient = New System.Net.WebClient()
If bEncode = True Then
webClient.Encoding = System.Text.Encoding.UTF8
End If
Dim strResult As String = webClient.DownloadString("http://www.example.com/aaa/?only=true")
但是在网络浏览器中,我看到正常 html 当我点击查看源代码时,它是正常的。
为什么我无法将页面源下载到我的字符串中?为什么要下载 google 字符串?
非常感谢。
添加的注释:
** 很抱歉我的英语不好。
我可以通过 HttpClient
获取 html 页面HttpClient client = new HttpClient();
var html = await client.GetStringAsync("http://www.betbrain.com/football/brazil/cearense-1/horizonte-v-sao-benedito-ce/1x2/full-time-excluding-overtime/?only=true&attempt=1");
开头为
<div id="oddsDetailRTFDisabled" class="hidden">
<div class="FormMessage FormError">
<span class="FormIcon">MESSAGES:</span>
<h2 class="FormTitle">Real time updates disabled</h2>
<p class="FormP">The automatic updates don't work if there are more than four Odds pages (tabs) opened with the same browser. If this is not the case try clearing your browser's cache (temporary internet files).</p>
</div>
</div>
......