private void VerifyAndPerformPageRedirection()
{
if(currentPage == null) return;
// Force formatting so that the destination can be detected
Content.GetFormattedPageContent(currentPage, true);
PageInfo dest = Redirections.GetDestination(currentPage);
if(dest == null) return;
if(dest != null) {
if(Request["NoRedirect"] != "1") {
UrlTools.Redirect(dest.FullName + Settings.PageExtension + "?From=" + currentPage.FullName, false);
}
else {
// Write redirection hint
StringBuilder sb = new StringBuilder();
sb.Append(@"<div id=""RedirectionDiv"">");
sb.Append(Properties.Messages.ThisPageRedirectsTo);
sb.Append(": ");
sb.Append(@"<a href=""");
UrlTools.BuildUrl(sb, "++", Tools.UrlEncode(dest.FullName), Settings.PageExtension, "?From=", Tools.UrlEncode(currentPage.FullName));
sb.Append(@""">");
PageContent k = Content.GetPageContent(dest, true);
sb.Append(FormattingPipeline.PrepareTitle(k.Title, false, FormattingContext.PageContent, currentPage));
sb.Append("</a></div>");
Literal literal = new Literal();
literal.Text = sb.ToString();
plhContent.Controls.Add(literal);
}
}
}