Reputation: 16219
I'm working on vb.net
project and i have created dynamic news tiker.
code :
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
But this is giving me and following error :
For security reasons DTD is prohibited in this XML document. To enable DTD processing set the DtdProcessing property on XmlReaderSettings to Parse and pass the settings into XmlReader.Create method.
where should I mention setting in my code?
Upvotes: 1
Views: 2382
Reputation: 1
Dim settings As New XmlReaderSettings
settings.DtdProcessing = DtdProcessing.Parse
settings.ValidationType = ValidationType.DTD
Dim xmlR = XmlReader.Create(Currentfile, settings)
Upvotes: 0
Reputation: 78
Dim settings As XmlReaderSettings = new XmlReaderSettings()
settings.DtdProcessing = DtdProcessing.Parse;
Dim myTweets As SyndicationFeed = SyndicationFeed.Load(XmlReader.Create("https://twitter.com/ashuthinks"),settings)
Sorry if my syntax is off, don't write much VB.NET code.
Upvotes: 0