如何在ASP.NET MVC上将Content-Type设置为完全“文本/纯文本?”>

问题描述 投票:0回答:1

代码

public class HomeController : Controller
{
    public ActionResult Index()
    {
        return Content("hello", "text/plain");
    }
}

正在响应标题

Content-Type: text/plain; charset=utf-8

我的问题是如何从响应标头Content-Type中删除“; charset = utf-8”?

这里How do I remove the charset from Content-Type in a ASP.NET Core MVC response?是在asp.net核心上的操作方法。

代码公共类HomeController:控制器{public ActionResult Index(){return Content(“ hello”,“ text / plain”);用标题Content-Type响应:text / plain; ...

c# asp.net-mvc asp.net-mvc-5 http-headers content-type
1个回答
0
投票

请尝试这个。

© www.soinside.com 2019 - 2024. All rights reserved.