Gerando Rss usando RSS Toolkit
1 – acesse o site http://www.codeplex.com/ASPNETRSSToolkit e baixe a dll.
2 – Importe a mesma para seu projeto, ou simplesmente araste-a para dentro da pasta Bin de eu projeto
3 – Crie uma página e faça o importe da DLL para ela
using RssToolkit.Rss;
4 – no Load da pagina:
//Inicianlizando RSS
var meurss = new RssDocument();
var rss = new RssChannel { PubDate = DateTime.Now.ToShortDateString(), Description = "Descrição", Title = "Título" };
meurss.Channel = rss;
meurss.Version = "2.0";
meurss.Channel.Items = new List<RssItem>();
List<Anuncios> a = new Anuncios().SelectFeed();
for (int i = 0; i < a.Count; i++)
{
var anunio = a[i];
var item = new RssItem
{
PubDate = anunio.Data.ToString(),
Title = anunio.Titulo,
Description = anunio.Descricao,
Link = anunio.Link
};
meurss.Channel.Items.Add(item);
}
//Retornando Stream xml
string outputXml = meurss.ToXml(DocumentType.Rss);
var document = new XmlDocument();
document.LoadXml(outputXml);
Response.ContentType = "text/xml";
document.Save(Response.OutputStream);
Response.End();