[英]How to set Content-Type to exactly “text/plain” on ASP.NET MVC?
The code编码
public class HomeController : Controller
{
public ActionResult Index()
{
return Content("hello", "text/plain");
}
}
is responding with header正在响应 header
Content-Type: text/plain; charset=utf-8
My question is how to remove "; charset=utf-8" from response header Content-Type?我的问题是如何从响应 header Content-Type 中删除“; charset=utf-8”?
Here How do I remove the charset from Content-Type in a ASP.NET Core MVC response?在这里如何从 ASP.NET Core MVC 响应中的 Content-Type 中删除字符集? it is how to do it on asp.net core.
这是如何在 asp.net 内核上执行此操作的。
You can clear the Charset
before Content()
您可以在
Content()
之前清除Charset
public ActionResult Index()
{
Response.Charset = "";
return Content("hello", "text/plain");
}
please try this one.请试试这个。
public ActionResult Index()
{
Response.ContentType = "text/plain";
return Content("your content");
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.