如何将ViewResult作为字符串?

时间:2016-06-09 11:08:16

标签: asp.net asp.net-mvc razor asp.net-core asp.net-core-mvc

如何将ViewResult作为字符串? 例如,当用户进行webrequest时,我可以返回如下页面:

return View("/helloworld");

但是我想把它作为一个字符串并用它做一些事情,例如:

string webpage = View("/helloworld").ToString(); //Get the ViewResult as a string.
// {...} do something with the webpage string.
return Content(webpage); //Now return it as you normally would

有可能吗?

0 个答案:

没有答案