Hello guys ,
i am going to develop a dynamic rss feed in asp.net and it is almost developed , only one problem is there that is the developed rss is working properly in ie8 but is not working in mozila , i don't know why so please help me about that... the code to develop rss dynamic is:
Imports System.Xml
Imports System.Data
Partial Class _Default
Inherits System.Web.UI.Page
''' <summary>
''' Call function writeRss on Page Load Events
''' </summary>
''' <param name="sender"></param>
''' <param name="e"></param>
''' <remarks></remarks>
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim strPageTitle As String = "Main title of the page."
Dim strPageTitleLink As String = "www.gksingh.co.nr"
Dim strLanguage As String = "en-us"
Dim strCopyrightContent As String = "© " & Now().Year & " Your Company Name. All Rights Reserved."
Dim strRefershInterval As String = "180"
Dim strWebMaster As String = "[email protected]"
Dim strManagingEditor As String = "[email protected]"
WriteRss(strPageTitle, strPageTitleLink, strLanguage, strManagingEditor, strWebMaster, strCopyrightContent, strRefershInterval)
End Sub
''' <summary>
''' This sub routine write dynamic RSS.
''' </summary>
''' <param name="pageTitle">Main title of the page</param>
''' <param name="pageTitleLink">Link of Page title</param>
''' <param name="language">Any default language.</param>
''' <param name="managingeditor">Managing Editor email id -This will not shown in the page</param>
''' <param name="webmaster">Web Master email id -This will not shown in the page</param>
''' <param name="copyright">Copy right content</param>
''' <param name="interval">refresh time, After defined minutes the software will ping RSS Feed URL for Updates.</param>
''' <remarks></remarks>
Private Sub WriteRss(ByVal pageTitle As String, ByVal pageTitleLink As String, ByVal language As String, ByVal managingeditor As String, ByVal webmaster As String, ByVal copyright As String, ByVal interval As String)
Response.Clear()
Response.ContentType = "text/xml"
Dim objX As New XmlTextWriter(Response.OutputStream, Encoding.UTF8)
objX.WriteStartDocument(True)
objX.WriteStartElement("rss")
objX.WriteAttributeString("version", "2.0")
objX.WriteStartElement("channel")
objX.WriteElementString("title", pageTitle)
objX.WriteElementString("link", pageTitleLink) ' It will be link on heading on the top of the rss page.
objX.WriteElementString("language", language)
objX.WriteElementString("managingEditor", managingeditor)
objX.WriteElementString("webMaster", webmaster)
objX.WriteElementString("copyright", copyright)
objX.WriteElementString("ttl", interval) 'ttl stands for time to live.After each 180 minutes rss reader will ping server for updates.
Dim ds As New DataSet()
Dim i As Int32 = 0
'Here i used XML database for better usability for this article. You can use any of the database
'You can implement condition like 'select top 10 from tablename' in your query.
ds.ReadXml(Server.MapPath("App_Data\data.xml"))
For i = 0 To ds.Tables(0).Rows.Count - 1
objX.WriteStartElement("item")
objX.WriteElementString("title", ds.Tables(0).Rows(i)(0))
objX.WriteElementString("description", "<img src='image\rss.jpg' alt='Add image in RSS'/>" & ds.Tables(0).Rows(i)(1))
objX.WriteElementString("link", "link on News heading")
objX.WriteElementString("author", ds.Tables(0).Rows(i)(5))
objX.WriteElementString("subject", "News Updates")
objX.WriteElementString("category", ds.Tables(0).Rows(i)(3))
objX.WriteElementString("pubDate", ds.Tables(0).Rows(i)(4).ToString()) ' if date is in different format you can change it by [.ToString('R')] where 'R' represent here special format of date like, Sun, 15 Jun 2008 21:15:07 GMT
objX.WriteEndElement()
Next
objX.WriteEndElement()
objX.WriteEndElement()
objX.WriteEndDocument()
objX.Flush()
objX.Close()
Response.End()
End Sub
End Class
please provide me some help. thank you