title: How to render a view to html string in asp.net core controller?
body: <p>In my asp.net core 2.0 application, I need to show the details of a payment receipt as a view to the user. I also need to send to user the same html text as an email (minus the top navigation bar).</p>
  
  <p>My thought was to put the payment details in a partial view. I can then use this partial view on the website as well as in the email.</p>
  
  <p>In appears <code>Html</code> object is injected into razor pages automatically such that one can, for example, call <code>@Html.Partial().</code> Is there a way to use this <code>Html</code> object from the Controller class? Or, is there a different mechanism to render <code>.cshtml</code> file into html string? Regards.</p>