<%@ WebHandler Language="C#" Class="rss" %> using System; using System.Web; using System.Data.SqlClient; using System.Configuration; using System.Web.UI.WebControls; public class rss : IHttpHandler { public void ProcessRequest (HttpContext context) { context.Response.ContentType = "text/plain"; context.Response.Write("\r\n"); context.Response.Write("\r\n"); context.Response.Write("\r\n"); context.Response.Write("es\r\n"); context.Response.Write("FUHEM EDUCACIÓN\r\n"); context.Response.Write("http://www.fuhem.es/educacion/\r\n"); context.Response.Write("Titular de centros escolares concertados. Educación como servicio público y elemento compensador de desigualdades. Educación laica.\r\n"); context.Response.Write("fuhem@fuhem.es\r\n"); context.Response.Write("" + fechaAhora() + "\r\n"); context.Response.Write("\r\n"); context.Response.Write("http://www.fuhem.es/imagenes/educacion.jpg\r\n"); context.Response.Write("Logo FUHEM\r\n"); context.Response.Write("88\r\n"); context.Response.Write("93\r\n"); context.Response.Write("Actualidad FUHEM Educación\r\n"); context.Response.Write("\r\n"); string idArea = constantes.area_educacion.ToString(); string fechaBusqueda = DateTime.Now.ToString(); int numero = numeroItems(); SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["FUHEM07ConnectionString1"].ConnectionString); SqlCommand comando = new SqlCommand(); //MOSTRAMOS LA ACTUALIDAD DE LA HOME try { comando.Connection = con; comando.CommandText = "Select top " + numero.ToString() + " n.titulo, n.campo_introductorio, n.fecha_inicio_publicacion, n.id_noticia From relacion_categorias_noticias As rn Inner Join categoria_noticias As c On c.id_categoria = rn.id_categoria Inner Join noticias As n On n.id_noticia = rn.id_noticia Where c.id_area = @area and n.fecha_inicio_publicacion <= @fecha and (n.fecha_fin_publicacion >= @fecha or n.fecha_fin_publicacion is null) and n.publicado = 1 and c.noticia_articulo = 1 and rn.destacada = 1 ORDER BY n.fecha_inicio_publicacion DESC"; SqlParameter paramID = new SqlParameter("area", idArea); SqlParameter paramFH = new SqlParameter("fecha", fechaBusqueda); comando.Parameters.Add(paramID); comando.Parameters.Add(paramFH); con.Open(); SqlDataReader read = comando.ExecuteReader(); if (read.HasRows) { context.Response.Write("Actualidad\r\n"); while (read.Read()) { context.Response.Write("\r\n"); context.Response.Write("" + read.GetString(0).Replace("&", "&") + "\r\n"); context.Response.Write("http://www.fuhem.es/educacion/noticias.aspx?v=" + read.GetInt32(3).ToString() + "&n=0\r\n"); context.Response.Write("http://www.fuhem.es/educacion/noticias.aspx?v=" + read.GetInt32(3).ToString() + "&n=0\r\n"); context.Response.Write("\r\n"); context.Response.Write("" + fecha(read.GetDateTime(2)) + "\r\n"); context.Response.Write("\r\n"); } } read.Close(); } catch (Exception) { } finally { con.Close(); } context.Response.Write("\r\n"); context.Response.Write("\r\n"); } private string fechaAhora() { DateTime ahora = DateTime.Now; return ahora.Year + "-" + ahora.Month + "-" + ahora.Day + " " + ahora.Hour + ":" + ahora.Minute + ":" + ahora.Second; } private string fecha(DateTime f) { return f.Year + "-" + f.Month + "-" + f.Day; } private int numeroItems() { int n = 0; SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["FUHEM07ConnectionString1"].ConnectionString); SqlCommand comando = new SqlCommand(); comando.CommandText = "select numero_destacadas_fuhem from opciones"; comando.Connection = con; try { con.Open(); SqlDataReader read = comando.ExecuteReader(); if (read.Read()) { n = read.GetInt32(0); } read.Close(); } catch (Exception) { } finally { con.Close(); } return n; } public bool IsReusable { get { return false; } } }