Help shape the future of CMS PaaS release notes! Take this quick survey and share your feedback.
AI OnAI Off
Help shape the future of CMS PaaS release notes! Take this quick survey and share your feedback.
You can define a InitializableModule, inherit it from IInitializableHttpModule.
Then bind you event like:
public void InitializeHttpEvents(HttpApplication application)
{
application.PreRequestHandlerExecute += this.ApplicationOnBeginRequest;
}
Now, inside your ApplicationOnBeginRequest method
private void ApplicationOnBeginRequest(object sender, EventArgs eventArgs)
{
var contentRouteHelper = ServiceLocator.Current.GetInstance<IContentRouteHelper>();
if (contentRouteHelper?.Content is PageData myPage)
{
var cat = myPage.Category.First();
var redirect = contentRouteHelper.Content.ParentLink + cat.ToString() + contentRouteHelper.ContentLink;
HttpContext.Current.Response.Redirect(redirectUrl);
}
}
Note: This is high level idea only. Put proper null checks and exception handling.
Thanks & Regards
Praful Jangid
I have a child page under start page as shown below. How to access child page with url "startpage/category/childpage." Normally we get url as "startpage/childpage" where category is property of PageData.