Web--Response

Posted zhaoyl9

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Web--Response相关的知识,希望对你有一定的参考价值。

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的主要内容,如果未能解决你的问题,请参考以下文章