Foros del Web

Foros del Web (http://www.forosdelweb.com/)
-   .NET (http://www.forosdelweb.com/f29/)
-   -   Rss Feed con ASP.NET (http://www.forosdelweb.com/f29/rss-feed-con-asp-net-260489/)

univercity 10/01/2005 04:33

Rss Feed con ASP.NET
 
Tengo este codigo, funciona bien, lo que no sé es como hacerlo para que se genere dinamicamente, como el que tienen aqui en los foros...

http://www.forosdelweb.com/index.xml

alguien me puede hechar una mano please... soy novato en Net y necesito la ayuda de Uds.





<%@ Page Language="C#" %>
<script runat="server">

private void Page_Load(object sender, System.EventArgs e)
{
System.Xml.XmlTextWriter writer = new System.Xml.XmlTextWriter(Response.OutputStream, System.Text.Encoding.UTF8);

escribirInicioRSS(writer);

agregarItemRSS(writer,"Hongos de la Madera","http://www.vmaule.com/productores/xml/leer.aspx?id=23", "");
agregarItemRSS(writer,"Los Consumidores del Futuro", "http://www.vmaule.com/productores/xml/leer.aspx?id=25", "");
agregarItemRSS(writer,"", "", "");

escribirFinalRSS(writer);
writer.Flush();

writer.Close();

Response.ContentEncoding = System.Text.Encoding.UTF8;
Response.ContentType = "text/xml";
Response.Cache.SetCacheability(HttpCacheability.Pu blic);

Response.End();
}

void Button1_Click(object sender, EventArgs e) {

}

//metodo que escribe los requirimientos iniciales del archivo e informacion general del canal
private System.Xml.XmlTextWriter escribirInicioRSS(System.Xml.XmlTextWriter writer)
{
writer.WriteStartDocument();
writer.WriteStartElement("rss");
writer.WriteAttributeString("version","2.0");
writer.WriteAttributeString("xmlns:blogChannel",
"http://backend.userland.com/blogChannelModule");
writer.WriteStartElement("channel");
writer.WriteElementString("title","Vmaule.com Ultimos Articulos");
writer.WriteElementString("link","http://www.vmaule.com/productores/xml/");
writer.WriteElementString("description",
"Ultimos 5 articulos publicados en vmaule.com");
writer.WriteElementString("copyright","Copyright 2004 vmaule.com");
writer.WriteElementString("generator","Creador de RSS por Alejandro Herrera E. v1.0");

return writer;
}

private System.Xml.XmlTextWriter agregarItemRSS(System.Xml.XmlTextWriter writer,
string sTitulo, string sLink,
string sDescripcion)
{
writer.WriteStartElement("item");
writer.WriteElementString("title",sTitulo);
writer.WriteElementString("link",sLink);
writer.WriteElementString("description",sDescripci on);
writer.WriteElementString("pubDate", DateTime.Now.ToString("r"));
writer.WriteEndElement();

return writer;
}


private System.Xml.XmlTextWriter escribirFinalRSS(System.Xml.XmlTextWriter writer)
{
writer.WriteEndElement();
writer.WriteEndElement();
writer.WriteEndDocument();

return writer;
}

</script>
<html>
<head>
</head>
<body>
</body>
</html>


La zona horaria es GMT -6. Ahora son las 09:30.

Desarrollado por vBulletin® Versión 3.8.7
Derechos de Autor ©2000 - 2026, Jelsoft Enterprises Ltd.