<%@ WebHandler Language="C#" Class="DynamicRobots.robotshandler" %> using System; using System.Web; namespace DynamicRobots { public class robotshandler : IHttpHandler { public void ProcessRequest(HttpContext context) { context = HttpContext.Current; HttpRequest req = context.Request; string[] domainParts = req.Url.Host.Split('.'); if (domainParts.Length > 2 && !domainParts[0].Equals("www")) { if (domainParts[0].ToString() == "diving") { context.Response.Write("User-Agent: /\n"); } else if (domainParts[0].ToString() == "synchronizedswimming") { context.Response.Write("User-Agent: /\n"); } else if (domainParts[0].ToString() == "waterpolo") { context.Response.Write("User-Agent: /\n"); } else if (domainParts[0].ToString() == "swim") { context.Response.Write("User-Agent: *\n"); context.Response.Write("Disallow: /Images/\n"); context.Response.Write("Disallow: /bin/\n"); context.Response.Write("Disallow: /CSS/\n"); context.Response.Write("Disallow: /jQuery/\n"); context.Response.Write("Disallow: /Product/\n"); context.Response.Write("Disallow: /Scripts/\n"); context.Response.Write("Disallow: /Shop/\n"); context.Response.Write("Disallow: /Helpers/\n"); context.Response.Write("Disallow: /Ocx/\n"); context.Response.Write("Disallow: /DragDrop/\n"); context.Response.Write("Disallow: /Supporter/\n"); context.Response.Write("Disallow: /SwimCenter/\n"); context.Response.Write("Disallow: /Ajax-Loading/\n"); } } else { context.Response.Write("User-Agent: *\n"); context.Response.Write("Disallow: /Images/\n"); context.Response.Write("Disallow: /bin/\n"); context.Response.Write("Disallow: /CSS/\n"); context.Response.Write("Disallow: /jQuery/\n"); context.Response.Write("Disallow: /Product/\n"); context.Response.Write("Disallow: /Scripts/\n"); context.Response.Write("Disallow: /Shop/\n"); context.Response.Write("Disallow: /Helpers/\n"); context.Response.Write("Disallow: /Ocx/\n"); context.Response.Write("Disallow: /DragDrop/\n"); context.Response.Write("Disallow: /Supporter/\n"); context.Response.Write("Disallow: /SwimCenter/\n"); context.Response.Write("Disallow: /Ajax-Loading/\n"); } } public bool IsReusable { get { return false; } } } }