替换HttpResponse.ContentEncoding ASP.NET 5 [英] Replacement for HttpResponse.ContentEncoding ASP.NET 5

查看:90
本文介绍了替换HttpResponse.ContentEncoding ASP.NET 5的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人知道ASP.NET 5中是否存在HttpResponse.ContentEncoding的替代品? https://msdn. microsoft.com/en-us/library/system.web.httpresponse.contentencoding(v=vs.110).aspx

Does anyone know if there is a replacement in ASP.NET 5 for HttpResponse.ContentEncoding? https://msdn.microsoft.com/en-us/library/system.web.httpresponse.contentencoding(v=vs.110).aspx

推荐答案

示例:

var mediaType = new MediaTypeHeaderValue("application/json");
mediaType.Encoding = Encoding.UTF8;
httpContext.Response.ContentType = mediaType.ToString();

这篇关于替换HttpResponse.ContentEncoding ASP.NET 5的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆