protected ActionResult GetPage(int publicationId, int pageId) { using (new Tracer(publicationId, pageId)) { try { Common.Configuration.Localization localization = SetupLocalization(publicationId); PageModel pageModel; try { pageModel = ContentProviderExt.GetPageModel(pageId, localization); } catch (DxaItemNotFoundException ex) { Log.Info(ex.Message); return(NotFound()); } PageModelWithHttpResponseData pageModelWithHttpResponseData = pageModel as PageModelWithHttpResponseData; pageModelWithHttpResponseData?.SetHttpResponseData(System.Web.HttpContext.Current.Response); SetupViewData(pageModel); PageModel model = (EnrichModel(pageModel) as PageModel) ?? pageModel; WebRequestContext.PageModel = model; return(View(model.MvcData.ViewName, model)); } catch (Exception ex) { Log.Error(ex); return(ServerError()); } } }
public virtual ActionResult Binary(int publicationId, int binaryId, params string[] rest) { try { var docsLocalization = new DocsLocalization(publicationId); StaticContentItem content = ContentProviderExt.GetStaticContentItem(binaryId, docsLocalization); return(new FileStreamResult(content.GetContentStream(), content.ContentType)); } catch (Exception ex) { return(ServerError(ex)); } }