<%@ WebHandler Language="C#" Class="robotshandler" %> using System; using System.Web; using System.Configuration; public class robotshandler: IHttpHandler { private long? _IdRevista; private string _nombreRevista; public string nRevista { get { if (null == this._IdRevista) { string VirtualFolder = HttpContext.Current.Request.ServerVariables["HTTP_HOST"]; Type eRevistas = typeof(CRevista.Revista); //Por defecto se deja la revista semana this._IdRevista = (int)CRevista.Revista.Semana; this._nombreRevista = "Semana"; foreach (string nombreRevista in Enum.GetNames(eRevistas)) { if (VirtualFolder.ToLower().IndexOf(nombreRevista.ToLower()) >= 0) { this._IdRevista = (int)((CRevista.Revista)Enum.Parse(eRevistas, nombreRevista)); _nombreRevista = nombreRevista; break; } } } if(Application["nRevista"] == null) Application.Add("nRevista", this._nombreRevista); else Application["nRevista"] = this._nombreRevista; return this._nombreRevista; } } public void ProcessRequest (HttpContext context) { context.Response.Clear(); context.Response.ContentType="text/plain"; context.Response.Write("User-agent: *\n"); string nombreRevista = nRevista.ToString(); context.Response.Write("Sitemap: "+ConfigurationManager.AppSettings["PathSitemapNoticias"+nombreRevista]+"\n"); context.Response.Write("Sitemap: "+ConfigurationManager.AppSettings["PathSitemapNews"+nombreRevista]+"\n"); context.Response.Write("Sitemap: "+ConfigurationManager.AppSettings["PathSitemapSecciones"+nombreRevista]+"\n"); } public bool IsReusable { get {return false;} } }