在经典的 ASP.NET Web Forms View 引擎中,我们可以将 .aspx 页面中的 Content Type 设置为所需的类型。
Razor 中是否有直接/推荐的等效项?
最佳答案
您应该在操作方法中设置不同的内容类型。
public ActionResult MyAction() {
Response.ContentType = "something";
return View();
}
关于asp.net-mvc - 如何在 razor (CSHTML) 中设置内容类型?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4411841/