public string RenderToHtml(RazorPage razorPage, out IRazorView razorView, object model = null, string layout = null)
{
if (razorPage == null)
throw new ArgumentNullException("razorPage");
var httpReq = new BasicRequest();
if (layout != null)
{
httpReq.Items[RazorPageResolver.LayoutKey] = layout;
}
razorView = PageResolver.ResolveAndExecuteRazorPage(
httpReq: httpReq,
httpRes: httpReq.Response,
model: model,
razorPage: razorPage);
var ms = (MemoryStream)httpReq.Response.OutputStream;
return ms.ToArray().FromUtf8Bytes();
}
}