public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; //请求发起用户的在线编号 string olId = Utils.InputText(context.Request.Form["olid"]); //最后获取到的消息编号 DateTime lastPostTime = Utils.GetDateTime(context.Request.Form["lastTime"], DateTime.Now); EyouSoft.BLL.OnLineServer.OLServer bll = new EyouSoft.BLL.OnLineServer.OLServer(); IList <EyouSoft.Model.OnLineServer.OlServerMessageInfo> messages = bll.GetMessages(olId, lastPostTime); context.Response.Write(JsonConvert.SerializeObject(messages)); }
public void ProcessRequest(HttpContext context) { string saveFileName = HttpUtility.UrlEncode(fileName); context.Response.Clear(); context.Response.Buffer = true; context.Response.Charset = "utf-8"; context.Response.AppendHeader("Content-Disposition", string.Format("attachment;filename={0}", saveFileName)); context.Response.ContentEncoding = System.Text.Encoding.GetEncoding("utf-8"); context.Response.ContentType = "text/plain"; System.Text.StringBuilder sb = new System.Text.StringBuilder(); sb.Append("消息记录\r\n\r\n"); sb.Append("=================================================\r\n"); sb.AppendFormat("消息保存时间:{0}\r\n", DateTime.Now); sb.Append("=================================================\r\n\r\n"); string olId = Utils.InputText(context.Request.QueryString["olid"]); bool isService = Utils.GetInt(context.Request.QueryString["service"], 0) == 2009 ? true : false; EyouSoft.Model.OnLineServer.OlServerUserInfo info = OlServerUtility.GetOlCookieInfo(isService); if (info != null && info.OId == olId) { EyouSoft.BLL.OnLineServer.OLServer bll = new EyouSoft.BLL.OnLineServer.OLServer(); IList <EyouSoft.Model.OnLineServer.OlServerMessageInfo> items = bll.GetMessages(olId, null); bll = null; foreach (EyouSoft.Model.OnLineServer.OlServerMessageInfo item in items) { if (item.SendId == olId) { sb.AppendFormat("{0} {1} 对 {2} 说:\r\n{3}\r\n\r\n", item.SendTime, "我", item.AcceptName, item.Message); } else { sb.AppendFormat("{0} {1} 对 {2} 说:\r\n{3}\r\n\r\n", item.SendTime, item.SendName, "我", item.Message); } } items = null; } context.Response.Write(sb.ToString()); context.Response.End(); }