private static void doRender(string PlaceholderType, string RenderFunction, HtmlTextWriter writer, CmsPage page, int identifier, CmsLanguage langToRenderFor, string[] subParamsArray, string templateFilename) { try { // Render() parameters are set in BaseCmsPlaceholder PlaceholderUtils.InvokePlaceholderFunction(PlaceholderType, RenderFunction, new object[] { writer, page, identifier, langToRenderFor, subParamsArray }); } catch (Exception ex) { if (ex is System.Threading.ThreadAbortException) { // the placeholder or control did a Response.End return; } else if (ex is CmsPageNotFoundException || ex.InnerException is CmsPageNotFoundException) { CmsContext.HandleNotFoundException(); } else if (ex is CmsPlaceholderNeedsRedirectionException || ex.InnerException is CmsPlaceholderNeedsRedirectionException) { // due to the dynamic nature of placeholders, // placeholders can not redirect on their own, so must raise an Exception to do so. if (HttpContext.Current != null && HttpContext.Current.Response != null) { System.Web.HttpResponse resp = System.Web.HttpContext.Current.Response; resp.Clear(); resp.ClearContent(); resp.ClearHeaders(); string targetUrl = (ex.InnerException as CmsPlaceholderNeedsRedirectionException).TargetUrl; resp.StatusCode = 301; // Moved Permanently resp.AddHeader("Location", targetUrl); resp.Redirect(targetUrl, true); } } else { throw new TemplateExecutionException(ex.InnerException, templateFilename, "Error in Placeholder, or Unknown Placeholder in " + PlaceholderType + " Template<p>root exception: " + ex.Message); } } } // callExternalPlaceholderRender