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