1

I'd want to save HTML that's being generated by

return View("view name", ComplexModel); in Controller's method with IActionResult return type

Is it possible to extract that html without obtaining it from user side by e.g JavaScript?

Something like:

string html = View("view name", ComplexModel).RawHtml;

4
  • 1
    Possible duplicate of How to render an ASP.NET MVC view as a string? Commented Jan 21, 2019 at 15:19
  • Possible duplicate of Get html from MVC 4 view into a string Commented Jan 21, 2019 at 15:23
  • @AFriend @BrankVictoria are you sure it applies to .net core? 'Engines' does not exist in the namespace 'Microsoft.AspNetCore.Mvc.ViewEngines' Commented Jan 21, 2019 at 15:26
  • This answer seems to address core 2 directly Commented Jan 21, 2019 at 15:34

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.