我正在做vb.net
项目,我已经创建了动态新闻 tiker。
代码 :
Imports System.ServiceModel.Syndication
Imports System.Xml
Partial Class DynamicTicker
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
'Get the latest syndicated content from my Twitter feed!
Dim myTweets As SyndicationFeed = SyndicationFeed.Load(XmlReader.Create("https://twitter.com/ashuthinks"))
'Bind myTweets to the ListView
lvTweets.DataSource = myTweets.Items
lvTweets.DataBind()
End Sub
Protected Function FormatSummary(ByVal summary As String) As String
Const SummaryHeader As String = "ScottOnWriting: "
'Remove the leading "ScottOnWriting: "
If summary.StartsWith(SummaryHeader) Then
Return summary.Substring(SummaryHeader.Length)
End If
End Function
Protected Function FormatPubDate(ByVal pubDate As DateTime) As String
Return pubDate.ToString("h:mm, MMM d")
End Function
End Class
但这给了我和以下错误:
出于安全原因,此 XML 文档中禁止使用 DTD。要启用 DTD 处理,请将 XmlReaderSettings 上的 DtdProcessing 属性设置为 Parse 并将设置传递给 XmlReader.Create 方法。
我应该在我的代码中在哪里提到设置?