我想从其他 asp.net 站点使用我博客的 RSS 提要。我无法获取 RSS 数据。我尝试了不同的方法(如 HttpWebRequest)来使用 RSS 提要,但我总是遇到同样的错误。
WebException was caught.
The underlying connection was closed: An unexpected error occurred during an import operation.
有什么问题?
提要地址:http ://blog.melihmucuk.com/feed/ 我需要帖子标题、链接和发布日期。
例如 :
Try
Dim reader As XmlTextReader = New XmlTextReader("http://blog.melihmucuk.com/feed/")
Dim ds As DataSet = New DataSet()
ds.ReadXml(reader) // incorrect line
Catch ex As Exception
End Try
我认为,这是一个简单的任务,但我不知道是什么问题。
我也试试这个:
Try
Dim title As String
Dim link As String
Dim description As String
Dim reader = XmlReader.Create("http://blog.melihmucuk.com/feed/")//incorrect line
Dim feed = SyndicationFeed.Load(reader)
For Each item In feed.Items
title = item.Title.Text
link = item.Links(0).Uri.ToString
Next
HyperLink1.Text = title
HyperLink1.NavigateUrl = link
Label1.Text = description
Catch ex As Exception
End Try