我想獲得該頁面的源代碼爲例:Web客戶端總是返回一個空的源代碼
我使用Web客戶端(DownloadString和DownloadFile)或HttpWebRequest的。但是,我總是得到一個空字符串(Code source)。
使用firefox,Edge或其他瀏覽器,我可以毫無問題地獲取代碼源。
如何獲取給定示例的源代碼。
這是我用過的很多代碼的代碼:
Using client = New WebClient()
client.Headers.Add("user-agent", "Mozilla/5.0 (Windows NT 10.0; rv:40.0) Gecko/20100101 Firefox/40.0")
Dim MyURL As String = "https://www.virustotal.com/fr/file/c65ce5ab02b69358d07b56434527d3292ea2cb12357047e6a396a5b27d9ef680/analysis/"
Dim Source_Code As String = client.DownloadString(MyURL)
MsgBox(Source_Code)
textbox1.text = Source_Code
End Using
NB 2:Web客戶端正常工作與所有其他站點。
注意1:我不喜歡使用Webbrowser或這樣的控件。
plz發佈您的代碼 –
您使用什麼代碼下載? –
@ It'sNotALie。 我使用示例代碼編輯主題。 – Tajrib