码迷,mamicode.com
首页 > Web开发 > 详细

Web--Response

时间:2019-06-28 17:56:38      阅读:123      评论:0      收藏:0      [点我收藏+]

标签:system   content   app   pac   job   --   public   enc   turn   

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; }
    }
}

 

Web--Response

标签:system   content   app   pac   job   --   public   enc   turn   

原文地址:https://www.cnblogs.com/zhaoyl9/p/11104042.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!