如何设置在剃刀(CSHTML)的contentType? [英] How to set contenttype in razor (CSHTML)?
本文介绍了如何设置在剃刀(CSHTML)的contentType?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在经典的ASP.NET Web窗体视图引擎,我们可以在.aspx页面中设置的ContentType所需类型。
In classic ASP.NET Web Forms view engine, we can set the ContentType in the .aspx page to the desired type.
是否有剃刀直接/推荐的相同呢?
Is there a direct/recommended equivalent in Razor?
推荐答案
你应该在你的操作方法设置了不同的内容类型。
You should set a different content type in your action method.
public ActionResult MyAction() {
Response.ContentType = "something";
return View();
}
这篇关于如何设置在剃刀(CSHTML)的contentType?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文