The code
public class HomeController : Controller
{
public ActionResult Index()
{
return Content("hello", "text/plain");
}
}
is responding with header
Content-Type: text/plain; charset=utf-8
My question is how to remove "; charset=utf-8" from response header Content-Type?
Here How do I remove the charset from Content-Type in a ASP.NET Core MVC response? it is how to do it on asp.net core.
You can clear the Charset
before Content()
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");
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.