#if NETFX using System; using System.Collections.Generic; using System.Text; using System.Web; namespace Apewer.Web { /// ApiHttpHandler public class ApiHttpHandler : IHttpHandler { /// public bool IsReusable { get { return false; } } /// public void ProcessRequest(HttpContext context) { //// 忽略跨域选项请求。 //if (context.Request.HttpMethod.ToLower() == "options") return; //// 阻止浏览器请求网站图标。 //if (context.Request.Url.AbsolutePath.ToLower().StartsWith("/favicon.ico")) return; //// 阻止搜索引擎收录。 //if (context.Request.Url.AbsolutePath.ToLower().StartsWith("/robot.txt")) //{ // context.Response.ContentType = "text/plain"; // context.Response.Write("User-agent: *\nDisallow: / \n"); // return; //} ApiInvoker.Execute(); } } } #endif