Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more
AI OnAI Off
Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more
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.