You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 lines
1.0 KiB

  1. #if NETFX
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Text;
  5. using System.Web;
  6. namespace Apewer.Web
  7. {
  8. /// <summary>ApiHttpHandler</summary>
  9. public class ApiHttpHandler : IHttpHandler
  10. {
  11. /// <summary></summary>
  12. public bool IsReusable { get { return false; } }
  13. /// <summary></summary>
  14. public void ProcessRequest(HttpContext context)
  15. {
  16. //// 忽略跨域选项请求。
  17. //if (context.Request.HttpMethod.ToLower() == "options") return;
  18. //// 阻止浏览器请求网站图标。
  19. //if (context.Request.Url.AbsolutePath.ToLower().StartsWith("/favicon.ico")) return;
  20. //// 阻止搜索引擎收录。
  21. //if (context.Request.Url.AbsolutePath.ToLower().StartsWith("/robot.txt"))
  22. //{
  23. // context.Response.ContentType = "text/plain";
  24. // context.Response.Write("User-agent: *\nDisallow: / \n");
  25. // return;
  26. //}
  27. ApiInvoker.Execute();
  28. }
  29. }
  30. }
  31. #endif