Replacement for HttpResponse.ContentEncoding ASP.NET 5

妖精的绣舞 提交于 2019-12-20 01:58:19

问题


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


回答1:


Example:

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



回答2:


Microsoft.Framework.WebEncoders.EncoderExtensions

have HtmlEncode, JavaScriptStringEncode and UrlEncode extensions

and the base Class is Microsoft.Framework.WebEncoders



来源:https://stackoverflow.com/questions/31320263/replacement-for-httpresponse-contentencoding-asp-net-5

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!