<%@ WebHandler Language="C#" Class="BrandSites.robotshandler" %> using System; using System.Web; using System.IO; using System.Web; using System.Text; using System.Data; using System.Xml; using BrandSites_BLL.Cache; namespace BrandSites { public class robotshandler: IHttpHandler { public void ProcessRequest (HttpContext context) { BrandSites_BLL.Domain _domain = new BrandSites_BLL.Domain(); string strDomain = HttpContext.Current.Request.Url.Host; _domain.LoadDomain(strDomain); /// load XML site map XmlDocument _sitemap = new XmlDocument(); if (strDomain.Equals("www.proactiv.se")) { _sitemap.LoadXml("~/App_Data/smproactse.xml"); _sitemap.Save(HttpContext.Current.Server.MapPath(String.Format("~/{0}.xml", _domain.Name))); } else { _sitemap.LoadXml(_domain.Sitemap); _sitemap.Save(HttpContext.Current.Server.MapPath(String.Format("~/{0}.xml", _domain.Name))); } string _xmlFile = string.Empty; /// context.Response.ContentType = "text/plain"; context.Response.Write("User-agent: *\n"); context.Response.Write("Disallow: /bin/ \n"); context.Response.Write(String.Format("Sitemap: http://{0}/{0}.xml", _domain.Name)); } public bool IsReusable { get {return false;} } } }