ServerTime.ashx 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. <%@ WebHandler Language="C#" Class="ServerTime" %>
  2. using System;
  3. using System.Web;
  4. using System.Web.SessionState;
  5. using System.Configuration;
  6. using System.Data;
  7. using Curtain.DataAccess;
  8. using Curtain.Log;
  9. using DK.XuWei.WebMes;
  10. using Newtonsoft.Json.Linq;
  11. using System.Collections.Generic;
  12. public class ServerTime : IHttpHandler {
  13. public void ProcessRequest(HttpContext context)
  14. {
  15. context.Response.ContentType = "text/plain";
  16. using (IDataAccess conn = DataAccess.Create())
  17. {
  18. if (context.Request["m"].ToString() == "fwq")
  19. {
  20. string time = DateTime.Now.ToString("yyyy年MM月dd日 HH:mm ");
  21. Dictionary<string, string> d = new Dictionary<string, string>();
  22. JObject json = new JObject(
  23. new JProperty("success", true),
  24. new JProperty("sj", time)
  25. );
  26. context.Response.Write(json.ToString());
  27. }
  28. }
  29. }
  30. public bool IsReusable {
  31. get {
  32. return false;
  33. }
  34. }
  35. }