|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Publish RSS feed into a .NET aspx file
Hi
I want to publish this feed: http://blog.holidaycottagescornwall.com/?feed=rss2 Into a .aspx file, I normally use the following code on a normal windows hosting server: <% Response.Expires = -1 URLToRSS = "http://blog.holidaycottagescornwall.com/?feed=rss2" MaxNumberOfItems = 7 MainTemplateHeader = "<table>" MainTemplateFooter = "</table>" temTemplate = "<tr><td><a href=" & """{LINK}""" & " target=" & chr(34) & "_blank" & chr(34) & ">{TITLE}</a><BR>{DESCRIPTION}</td></tr>" ErrorMessage = "Error has occured while trying to process " &URLToRSS & "<BR>Please contact web-master" Set xmlHttp = Server.CreateObject("MSXML2.XMLHTTP.3.0") xmlHttp.Open "Get", URLToRSS, false xmlHttp.Send() RSSXML = xmlHttp.ResponseText Set xmlDOM = Server.CreateObject("MSXML2.DomDocument.3.0") xmlDOM.async = false xmlDOM.LoadXml(RSSXML) Set xmlHttp = Nothing ' clear HTTP object Set RSSItems = xmlDOM.getElementsByTagName("item") ' collect all "items" from downloaded RSS Set xmlDOM = Nothing ' clear XML RSSItemsCount = RSSItems.Length-1 if RSSItemsCount > 0 then Response.Write MainTemplateHeader End If j = -1 For i = 0 To RSSItemsCount Set RSSItem = RSSItems.Item(i) for each child in RSSItem.childNodes Select case lcase(child.nodeName) case "title" RSStitle = child.text case "link" RSSlink = child.text case "description" RSSdescription = child.text End Select next If (InStr(RSSTitle,Keyword1)>0) or (InStr(RSSTitle,Keyword2)>0) or (InStr(RSSDescription,Keyword1)>0) or (InStr(RSSDescription,Keyword2)>0) then j = J+1 if J<MaxNumberOfItems then ItemContent = Replace(ItemTemplate,"{LINK}",RSSlink) ItemContent = Replace(ItemContent,"{TITLE}",RSSTitle) Response.Write Replace(ItemContent,"{DESCRIPTION}",RSSDescription) ItemContent = "" End if End If Next if RSSItemsCount > 0 then Response.Write MainTemplateFooter else Response.Write ErrorMessage End If %> Which normally works fine but it doesnt compile on a .NET server, does anyone know how I can publish this feed into a .aspx page ? Cheers. |
![]() |
| Viewing: SEO Chat Forums > Search Engine Strategies > Blogs, Tagging, RSS Feeds > Publish RSS feed into a .NET aspx file |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|