使用ASP.NET,如何将页面源转换为字符串?
我遇到了错误:
BC30002:类型'WebRequest'未定义
感谢您的帮助。
我的代码
<html>
<head><title>Get HTML Page Source</title></head>
<body>
<center>Page Source Display<br><br></center>
<%
DIM strUrl, websitesource, strHtml
Response.Write("Page Source Display<br>")
strUrl = "http://www.jb.com.br"
Response.Write(strUrl)
Dim myReq As WebRequest = WebRequest.Create(strUrl)
Dim myWebResponse As WebResponse = myReq.GetResponse()
Dim dataStream As Stream = myWebResponse.GetResponseStream()
Dim reader As New StreamReader(dataStream, System.Text.Encoding.UTF8)
Dim responseFromServer As String = reader.ReadToEnd()
%>
</body>
</html>