public void ProcessRequest(HttpContext context) { var host = Host.Get(Host.DefaultId) as Host; if (host == null) { return; } var uiPage = new System.Web.UI.Page(); uiPage.GetType().GetField("_request", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance).SetValue(uiPage, context.Request); uiPage.GetType().GetField("_response", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance).SetValue(uiPage, context.Response); host.SetRequestContext(_requestContext); int index = 0; foreach (var ccf in _page.ContentFragments) { string hostId = _configuredContentFragmentService.GetHostIdentifier(ccf); host.SetConfiguration(hostId, ccf.Configuration); host.Render(hostId, ccf.InstanceId, uiPage); index++; } using (var outputStream = context.Response.OutputStream) { using (var streamWriter = new System.IO.StreamWriter(outputStream)) { using (var htmlWriter = new System.Web.UI.Html32TextWriter(streamWriter)) { uiPage.RenderControl(htmlWriter); } } } }