Replacement for HttpResponse.ContentEncoding ASP.NET 5

后端 未结 2 1344
暗喜
暗喜 2021-01-19 03:02

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=

相关标签:
2条回答
  • 2021-01-19 03:37

    Example:

    var mediaType = new MediaTypeHeaderValue("application/json");
    mediaType.Encoding = Encoding.UTF8;
    httpContext.Response.ContentType = mediaType.ToString();
    
    0 讨论(0)
  • 2021-01-19 03:47

    Microsoft.Framework.WebEncoders.EncoderExtensions

    have HtmlEncode, JavaScriptStringEncode and UrlEncode extensions

    and the base Class is Microsoft.Framework.WebEncoders

    0 讨论(0)
提交回复
热议问题