Post Processing Hook to set Subscription Timeout? - Ecommerce - Ecommerce - Progress Community

Post Processing Hook to set Subscription Timeout?


Post Processing Hook to set Subscription Timeout?

  • Post Processing Hook to set Subscription Timeout?
  • My Ecommerce application is to provide access to Private Sitefinity Blog Content for a period of a year, just like a magazine subscription.

    I have Ecommerce working to grant the user the correct Role Permissions after their purchase but I need a method of having their Role expire 365 days from the date of purchase.
  • Hello Rick,

    You can use any .Net based Job Scheduler for doing this task. For this example I am using . You can add it to your project by using Nuget ( )

    Then add this below code to your application. Please feel free to change the code below according to your needs.
    using System;
    using System.Linq;
    using Quartz;
    using Telerik.Sitefinity.Security;
    using Telerik.Sitefinity.Abstractions;
    namespace SitefinityWebApp
        public class HourlyJob : IJob
            public HourlyJob()
            public static void ScheduleJob(IScheduler sc)
                JobDetail job = new JobDetail("HourlyJob", "ExecuteTask", typeof(HourlyJob));
                sc.ScheduleJob(job, TriggerUtils.MakeHourlyTrigger("HourlyTrigger"));
            public void Execute(JobExecutionContext context)
                    Guid roleId = Guid.NewGuid(); //Id of the role you want to remove the user from.
                    RoleManager roleManager = RoleManager.GetManager();
                    UserManager userManager = UserManager.GetManager();
                    var role = roleManager.GetRole(roleId);
                    var users = userManager.GetUsers();
                    foreach (var user in users)
                        if (roleManager.IsUserInRole(user.Id, role.Id) && MyCustomRuleForDeterminingIfUserHasToBeRemovedFromRole(user.Id,role.Id))
                            roleManager.RemoveUserFromRole(user.Id, role);
                catch (Exception ex)
            private bool MyCustomRuleForDeterminingIfUserHasToBeRemovedFromRole(Guid userId, Guid roleId)
                //Add your custom logic here
                return true;

    and in Global.asax in your Application_Start method, register the Job using the snippet below.
    protected void Application_Start(object sender, EventArgs e)
        HourlyJob.ScheduleJob(new StdSchedulerFactory().GetScheduler());

    Let us know if need further assistance.

    Venkata Koppaka
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  • Is this still the best method of implementation of a membership with time limit? I am now using SF version 10.0