RSS Feed Duplicates RRS feed

  • Question

  • User-617274320 posted

    I've searched and found several posts about setting up RSS Feeds and ended up using this one to create mine. 


    It seems to be working fine, however when I add the RSS feed to my outlook or when I refresh using Google reader i get duplicates of the articles every time. I've made sure that I am setting both the LastUpdated and PublishDate which look correct but for some reason i still get duplicates everytime i refresh (or every time i refresh and wait 60 seconds). Help would be greatly appreciated.

    Here's a temp link to the feed


    And here's my code

    Imports System.ServiceModel.Syndication
    Partial Class Feed
        Inherits System.Web.UI.Page
        Enum FeedType
        End Enum
        Private _CurrentFeedType As FeedType
        Public Property CurrentFeedType() As FeedType
                Return _CurrentFeedType
            End Get
            Set(value As FeedType)
                _CurrentFeedType = value
            End Set
        End Property
        Private Sub LoadFeedData()
            Dim oBlogs As New StingrayCMS.Content.Blog
            If oBlogs.HasError = True OrElse oBlogs.Count < 1 Then
                Exit Sub
            End If
            'Set Feed Type
            Select Case True
                Case Request.QueryString("FeedType") = "RSS"
                    _CurrentFeedType = FeedType.RSS
                    Response.ContentType = "application/rss+xml"
                Case Request.QueryString("FeedType") = "Atom"
                    _CurrentFeedType = FeedType.Atom
                    Response.ContentType = "application/atom+xml"
                Case Else 'Default to RSS
                    _CurrentFeedType = FeedType.RSS
                    Response.ContentType = "application/rss+xml"
            End Select
            'Set Syndication Variables
            Dim sSyndicationTitle As String = ""
            Dim sSyndicationDescription As String = ""
            Dim sSyndicationLink As String = ""
            Dim sSyndicationCopyright As String = ""
            Dim sSyndicationAuthorEmail As String = ""
            Dim oSetting As New StingrayCMS.Content.Setting()
            oSetting.LoadBy(StingrayCMS.Content.Setting.LookupType.Name, "Syndication Title")
            If oSetting.HasError = False AndAlso oSetting.Count > 0 Then
                sSyndicationTitle = oSetting.Value
            End If
            oSetting.LoadBy(StingrayCMS.Content.Setting.LookupType.Name, "Syndication Description")
            If oSetting.HasError = False AndAlso oSetting.Count > 0 Then
                sSyndicationDescription = oSetting.Value
            End If
            oSetting.LoadBy(StingrayCMS.Content.Setting.LookupType.Name, "Syndication Copyright")
            If oSetting.HasError = False AndAlso oSetting.Count > 0 Then
                sSyndicationCopyright = oSetting.Value
            End If
            oSetting.LoadBy(StingrayCMS.Content.Setting.LookupType.Name, "Syndication Author Email")
            If oSetting.HasError = False AndAlso oSetting.Count > 0 Then
                sSyndicationAuthorEmail = oSetting.Value
            End If
            sSyndicationLink = ConfigurationManager.AppSettings("SyndicationLandingLink")
            'Set Syndication Properties
            Dim oUtility As New StingrayCMS.Utilities.WebObject
            Dim oSyndicationFeed = New SyndicationFeed
            oSyndicationFeed.Title = TextSyndicationContent.CreatePlaintextContent(sSyndicationTitle)
            oSyndicationFeed.Description = TextSyndicationContent.CreatePlaintextContent(sSyndicationDescription)
            oSyndicationFeed.Links.Add(SyndicationLink.CreateAlternateLink(New Uri(sSyndicationLink)))
            oSyndicationFeed.Links.Add(SyndicationLink.CreateSelfLink(New Uri(oUtility.GetCurrentURLString)))
            oSyndicationFeed.Copyright = TextSyndicationContent.CreatePlaintextContent(sSyndicationCopyright)
            oSyndicationFeed.Language = "en-us"
            Dim lFeedList As New List(Of SyndicationItem)
            'Create Feed
            For Each oBlog In oBlogs.BlogsAsList
                Dim oSyndicationItem As New SyndicationItem
                oSyndicationItem.Title = TextSyndicationContent.CreatePlaintextContent(oBlog.Title)
                oSyndicationItem.Links.Add(SyndicationLink.CreateAlternateLink(New Uri(ConfigurationManager.AppSettings("RootSitePath") & "/" & ConfigurationManager.AppSettings("BlogRewriteDirectory") & "/" & oBlog.SeoURL)))
                oSyndicationItem.Summary = TextSyndicationContent.CreatePlaintextContent(oBlog.PreviewText)
                oSyndicationItem.PublishDate = oBlog.DateStamp
                oSyndicationItem.LastUpdatedTime = oBlog.DateStamp
                'Set Blog Categories
                If oBlog.HasError = False AndAlso oBlog.BlogCategoryCount > 0 Then
                    For Each oBlogCategory In oBlog.BlogCategoriesAsList
                        oSyndicationItem.Categories.Add(New SyndicationCategory(oBlogCategory.Name))
                End If
                'Set Author Info
                Dim oSyndicationAuthor As New SyndicationPerson
                oSyndicationAuthor.Email = sSyndicationAuthorEmail
                oSyndicationAuthor.Name = oBlog.Author
            oSyndicationFeed.Items = lFeedList
            'Write Feed
            Dim oFeedWriter As System.Xml.XmlWriter
            oFeedWriter = System.Xml.XmlWriter.Create(Response.OutputStream)
            Select Case _CurrentFeedType
                Case FeedType.RSS
                    Dim oAtomFormatter As New Atom10FeedFormatter(oSyndicationFeed)
                Case FeedType.Atom
                    Dim oRssFormatter As New Rss20FeedFormatter(oSyndicationFeed)
            End Select
        End Sub
        Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
        End Sub
    End Class

    Tuesday, September 18, 2012 3:52 PM


All replies