【发布时间】:2012-11-21 14:17:07
【问题描述】:
我想在 action 中实现 view.cshtml 文件,然后将其结果作为字符串获取,但不作为 ActionResult 从 action 方法返回。
用代码来解释,而不是:
public ActionResult Tesst()
{
// return ViewResult
return View();
}
一定是这样的:
public string Test()
{
string viewResult = string.Empty;
// implement "test.cshtml" and get its result as string
// assign result to viewResult variable
return viewResult;
}
任何帮助将不胜感激。
【问题讨论】:
-
只是想知道您想要实现什么 - 可能有更清洁的解决方案来解决您的问题。
标签: asp.net asp.net-mvc razor asp.net-mvc-4