using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web;
namespace Xima.FreamWork.Common.Web
{
public class Response : IHttpHandler
{
public void ProcessRequest(HttpContext context)
{
}
public static void OutResult(HttpContext context, MsgResult rs)
{
var obj = (JObject)JToken.FromObject(rs);
WriteJson(context, obj.ToString());
}
public static void WriteJson(HttpContext context, object strJson)
{
context.Response.Clear();
context.Response.ContentEncoding = Encoding.UTF8;
context.Response.ContentType = "text/plain;";
context.Response.Write(strJson);
context.Response.Flush();
context.ApplicationInstance.CompleteRequest();
//context.Response.End();
}
public bool IsReusable
{
get
{
return false;
}
}
}
public class MsgResult
{
public bool Success { get; set; }
public string Message { get; set; }
}
}