CMS 10.6: DSS Page Rendering Conflicts Occur If View Corresponds with Multiple Custom Controllers
In CMS 10.6, some pages may render incorrectly on the DSS when the corresponding views associate with multiple custom controllers and are not routed through them. In these scenarios, the page content may display as expanded XML without view formatting.
Known Issue Statement
In CMS 10.6, site pages may not render as expected on the DSS when the DSS imeplementation includes more than one custom controller override and the corresponding views are not routed through these custom controllers. For example, this rendering issue may take place when one custom controller is set as the CMSPageDefaultController while another controller is not.
Symptoms
After a DSS application pool recycle, the first page the user opens on the DSS may display as expanded XML without a view. This issue generally occurs when the view used to render the page content corresponds with a second custom controller.
Resolution
An upcoming CMS release will resolve this issue.
Workaround
As a CMS 10.6 workaround, add the RenderingContextOverride.cs class file to the DSS solution and modify the CMS page default conroller's viewOrXsltFallback
code. After you make these changes, rebuild the DSS solution and recycle the DSS application pool.
- Add RenderingContextOverride.cs to DSS Solution
- Modify CMSPageDefaultController.cs
- Rebuild DSS Solution and Recycle DSS Application Pool
Add RenderingContextOverride.cs to DSS Solution
To add the RenderingContextOverride.cs class to the DSS solution:
- Download RenderingContextOverride.zip to your server file system and extract the contents.
- Navigate to your DSS site's root folder.
- Open the DSS solution, Dynamic_Site_Server_Instance.sln, in Visual Studio, then expand the solution in the Solution Explorer.
- Right-click the Models folder, then select Add > Existing Item.
- Browser for and select RenderingContextOverride.cs, then click Add.
Visual Studios adds the class file to the Models folder.
Keep the DSS solution open in Visual Studio to modify the CMSPageDefaultController.cs file.
Modify CMSPageDefaultController.cs
To modify the viewOrXsltFallback
code in CMSPageDefaultController.cs:
- Expand the Controllers folder in the Visual Studio Solution Explorer, then open the CMSPageDefaultController.cs file.
- Navigate to
internal virtual ActionResult viewOrXsltFallback(CMSPageRequest pageRequest)
within the file, then select the code.The code will look similar to the following:
internal virtual ActionResult viewOrXsltFallback(CMSPageRequest pageRequest) { CMSPageRenderingEngine renderEngine = pageRequest.IsPreview ? new PreviewPageRenderingEngine(this, (pageRequest as CMSPageDocumentDynamicPreviewRequest).ContentStore, (pageRequest as CMSPageDocumentDynamicPreviewRequest).CurrentUser, _SitePath, _DTSitePath, _UseTempStylesheetsLocation, _LegacyTransformation) : new CMSPageRenderingEngine( this, _SitePath, _DTSitePath, _UseTempStylesheetsLocation, _LegacyTransformation); HttpContext.Items["PageRequest"] = pageRequest; CMSPageRequest model = pageRequest; if (pageRequest is ContentUnitPreviewRequest) { model = (pageRequest as ContentUnitPreviewRequest).Root as CMSPageRequest; model.Tag = "CUPreview"; } return renderEngine.Render(model); }
- Replace the existing
internal virtual ActionResult viewOrXsltFallback(CMSPageRequest pageRequest)
code within the file by copying pasting the following code:internal virtual ActionResult viewOrXsltFallback(CMSPageRequest pageRequest) { if (pageRequest.IsPreview) { var renderingEngine = new PreviewRenderingContextOverride(this, (pageRequest as CMSPageDocumentDynamicPreviewRequest).ContentStore, (pageRequest as CMSPageDocumentDynamicPreviewRequest).CurrentUser, _SitePath, _DTSitePath, _UseTempStylesheetsLocation, _LegacyTransformation); HttpContext.Items["PageRequest"] = pageRequest; CMSPageRequest model = pageRequest; if (pageRequest is ContentUnitPreviewRequest) { model = (pageRequest as ContentUnitPreviewRequest).Root as CMSPageRequest; model.Tag = "CUPreview"; } return renderingEngine.Render(model); } else { var renderingEngine = new RenderingContextOverride( this, _SitePath, _DTSitePath, _UseTempStylesheetsLocation, _LegacyTransformation); HttpContext.Items["PageRequest"] = pageRequest; CMSPageRequest model = pageRequest; if (pageRequest is ContentUnitPreviewRequest) { model = (pageRequest as ContentUnitPreviewRequest).Root as CMSPageRequest; model.Tag = "CUPreview"; } return renderingEngine.Render(model); } }
- Save and close CMSPageDefaultController.cs.
Rebuild DSS Solution and Recycle DSS Application Pool
- To rebuild the DSS solution, right-click the solution in the Visual Studio Solution Explorer and select Rebuild.
- To recycle the DSS application pool, navigate to the application pool in the Internet Information Services (IIS) Manager, then right-click the application pool and select Recycle.
Additional Information
If you have questions or encounter further issues, contact Ingeniux Support.
There are no comments yet.