asp.net-mvc – 如何在razor(CSHTML)中设置contenttype?

在经典的ASP.NET Web窗体视图引擎中,我们可以将.aspx页面中的ContentType设置为所需的类型.

剃须刀有直接/推荐的等同物吗?

解决方法

您应该在操作方法中设置不同的内容类型.
public ActionResult MyAction() {
    Response.ContentType = "something";
    return View();
}

相关文章

判断URL文件是不是在于在。private static bool UrlIsExist(...
由于在.net中,Request时出现有HTML或Javascript等字符串时,...
public static bool ProcessIdCard(this string idCard, out...
protected void Page_Load(object sender, EventArgs e){ Sc...