I tried your code by placing it at “Application_Start” event but it used to give me “Object reference not found error” then I moved it to one of my page again I used to get “Object reference not found error”.
So I had used following code:
var pages = App.WorkWith().Pages()
.Where(page => page.ApprovalWorkflowState == "Published")
foreach (var page in pages)
page.Page.CacheOutput = true;
To execute this code I need the user to have some permissions and I cannot assign permissions to all the users visiting my site. So how do I enable global caching.