<%@ WebHandler Language="C#" Class="AWV2.robotshandler" %> using System; using System.Web; using System.IO; using System.Web; using System.Text; using System.Data; using System.Xml; using AWV.DataAccess; namespace AWV2 { public class robotshandler: IHttpHandler { public void ProcessRequest(HttpContext context) { string strDomain = HttpContext.Current.Request.Url.Host; string Sitemap = ContentAccess.GenerateDynamicSitemap(strDomain); /// load XML site map XmlDocument _sitemap = new XmlDocument(); _sitemap.LoadXml(Sitemap); _sitemap.Save(HttpContext.Current.Server.MapPath(String.Format("~/sitemap.xml"))); /// 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}/sitemap.xml", strDomain)); } public bool IsReusable { get { return false; } } } }