Retroceder   Foros del Web > Programación para sitios web > .NET

Respuesta
 
Herramientas Desplegado
Antiguo 10-ene-2005, 03:33   #1 (permalink)
univercity está en el buen camino
 
Avatar de univercity
 
Fecha de Ingreso: noviembre-2002
Mensajes: 677
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>
__________________
"Lo importante es nunca dejar de hacerse preguntas"
Albert Einstein
univercity está desconectado   Responder Citando
Respuesta

No hay votos aún.


Herramientas
Desplegado

Normas de Publicación
No puedes crear nuevos temas
No puedes responder temas
No puedes subir archivos adjuntos
No puedes editar tus mensajes

BB code is Activado
Caritas están Activado
[IMG] está Activado
Código HTML está Desactivado


La Zona horaria es GMT -6. Ahora son las 22:17.


Message Board Statistics

LinkBacks Enabled by vBSEO 3.1.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93