Web Scraping ---处理此指令时发生错误

时间:2012-07-27 15:35:50

标签: .net vb.net web-scraping

我正试图在以下website中抓取表格:

它给了我"[an error occurred while processing this directive]"

它一直工作到昨天并开始抛出错误。我在"URLDownloadToFile"代码中尝试了"HTTPResponseStream"VB.net,但都抛出了相同的错误。

有什么想法?我不是在服务器端编程。这是一个简单的网页/屏幕刮擦。

添加代码段 -

    Dim web_address As String
    'web_address = "http://iso-ne.com/sys_ops/op_frcstng/7day_frcst/index.html"
    web_address = "http://iso-ne.com/sys_ops/op_frcstng/csvdocs/seven_day_forecast2012-07-27-10-13.csv"

    'Dim myReq As HttpWebRequest = WebRequest.Create(web_address)
    'Dim myReq_response As Net.HttpWebResponse
    'myReq_response = myReq.GetResponse()
    'Dim sr As IO.StreamReader = New StreamReader(myReq_response.GetResponseStream) 'Imports System.IO
    Dim strng As String
    'strng = sr.ReadToEnd()


    Dim fileDownloadReq As HttpWebRequest
    Dim fileDownloadResponse As HttpWebResponse
    ' fileDownloadReq = Net.HttpWebRequest.Create(web_address)
    'fileDownloadReq.Method = "get"
    ' fileDownloadResponse = fileDownloadReq.GetResponse


    'Get the data from the page
    'Dim stream As StreamReader = New StreamReader(fileDownloadResponse.GetResponseStream())
    'strng = stream.ReadToEnd()
    'fileDownloadResponse.Close()

    Dim genscapeDataFile As Long
    Dim raw_file_path As String
    raw_file_path = "C:\NEPOOL\ISONE_Seven_day_Raw.csv"
    genscapeDataFile = URLDownloadToFile(0, web_address, raw_file_path, 0, 0)

1 个答案:

答案 0 :(得分:0)

托管网页中出现错误,而不是代码中的错误。每当您遇到类似这样的无法解释的问题时,如果可能的话,您应该直接导航到该页面,并验证它是否按预期工作。

如果您在IE中导航到此页面,您将看到相同的错误消息。