0

How do you get a ViewResult as a string? For example, when a user makes a webrequest, i can return a page like this:

return View("/helloworld");

But i want to get it as a string and do something with it, for example:

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

Is it possible?

Assassinbeast
  • 1,207
  • 1
  • 17
  • 33
  • the exact duplicate question isn't about asp.net core, I was going to answer this question but since it is closed as duplicate I added my own aspnetcore specific answer to that question – Joe Audette Jun 09 '16 at 11:39
  • but then again the OP maybe was incorrect to tag his question as asp.net-core, the code in the question does not look like asp.net core code – Joe Audette Jun 09 '16 at 11:41

0 Answers0